comet-toolkit / comet_maths

GNU Lesser General Public License v3.0
6 stars 1 forks source link

Add pchip interpolation method #7

Closed madsted closed 7 months ago

JamieMcMillan commented 7 months ago

Feel free to ignore if you would like :)

It would be good to include testing for the changes you are adding. From the pytest coverage report, this file is hitting about 63 % statement coverage.

---------- coverage: platform darwin, python 3.11.6-final-0 ----------
Name                                                          Stmts   Miss  Cover
---------------------------------------------------------------------------------
comet_maths/__init__.py                                           8      0   100%
comet_maths/_version.py                                           1      0   100%
comet_maths/interpolation/__init__.py                             0      0   100%
comet_maths/interpolation/interpolation.py                      180     66    63%
comet_maths/interpolation/tests/__init__.py                       0      0   100%
comet_maths/interpolation/tests/test_interpolation.py           195     62    68%
comet_maths/linear_algebra/__init__.py                            0      0   100%
comet_maths/linear_algebra/matrix_calculation.py                148     45    70%
comet_maths/linear_algebra/matrix_conversion.py                 147     53    64%
comet_maths/linear_algebra/tests/__init__.py                      0      0   100%
comet_maths/linear_algebra/tests/test_matrix_calculation.py      43      4    91%
comet_maths/linear_algebra/tests/test_matrix_conversion.py       69      1    99%
comet_maths/random/__init__.py                                    0      0   100%
comet_maths/random/generate_sample.py                           186     31    83%
comet_maths/random/probability_density_function.py               19      1    95%
comet_maths/random/tests/__init__.py                              0      0   100%
comet_maths/random/tests/test_generate_sample.py                194      1    99%
---------------------------------------------------------------------------------
TOTAL                     

Here you could add a def test_pchip_interpolation() that largely follows the test structure already in place. And a verification of the NotImplementedError using with pytest.raises(NotImplementedError): (def test_pchip_interpolation_multi_dimension_warning).

madsted commented 7 months ago

@JamieMcMillan

Agreed, better unittest coverage for comet_maths & this module in particular would definitely be beneficial. I think that's out of the remit of this pull request however, as that will involve adding tests for more of the module, not just for the small change made in this request.