scottprahl / miepython

Mie scattering of light by perfect spheres
MIT License
164 stars 56 forks source link

Unit tests for arbitrary x length in miepython.mie #11

Closed jbecca closed 3 years ago

jbecca commented 3 years ago

I have added unit tests that test the functionality of the first 01-basics.ipynb, besides the last scattering example. I am assuming that as I add additional tests in to cover the different jupyter notebooks that there will be a notebook on scattering where I will make the unit test there.

I also moved the location of the test.py file for a little more efficient use in developing. Where the file was originally, it required the miepython package to always be installed in order to import the functions. Now that the file is in the top level directory, the absolute path will import the miepython functions without needing to have miepython installed as a python package. This makes developing a little simpler since there is no worry about updating the installed package cache after making small changes. Plus it allows for VSCode to easily detect the unit test and integrate them.

scottprahl commented 3 years ago

Thanks for the quick pull request.

Over the weekend, I added test_all_notebooks.py so that any notebook errors could easily be caught. It is not as good as individual unit tests, but it does ensure that all the notebooks run properly.

jbecca commented 3 years ago

Yeah, I noticed that new file. Hopefully that file removes the need to create unit tests for each individual notebook. If I find any other untested functionalities in the code during the numba clean up, I'll create tests for them.

scottprahl commented 3 years ago

yes, now make notecheck will run all the notebooks in the distribution. I see that 05_fog.ipynb and adaptive functioning.ipynb are both failing. I will try and fix these in the next few minutes. Fixed. No changes to code needed, just a missing library on the test computer and testing a notebook that is not ready for distribution.