vincentarelbundock / pycountrycode

GNU General Public License v3.0
3 stars 3 forks source link

Issue 4: Feature/property based testing #5

Closed frank113 closed 1 year ago

frank113 commented 1 year ago

Summary

This PR partially addresses issue #4 by adding property-based tests utilizing hypothesis and pytest.

Issues Addressed

Changes Made

  1. Add hypothesis in both poetry.lock and under dev in pyproject.toml
  2. Add custom property generation strategies in tests/custom_strategies.py
  3. Add documentation for added tests
  4. Add property based tests for:
    • iso3c to iso3n conversion. This replaces the prior test_numeric unit test
    • iso3c to fips conversion
    • Tests to ensure that when an invalid code is supplied the countrycode function will return None
  5. Test to ensure that the codelist dataframe has dimensions of 291 by 624. This test is included to protect against small, accidentical changes to the underlying csv file.

Considerations

Other

Looking forward to learning more about the plot functionality you mentioned in an issue thread!

vincentarelbundock commented 1 year ago

This looks fantastic! Thanks a ton for taking the time to write this. I really appreciate it!

Ooops, sounds like miscommunication. Adrien and I are not working on plots for pycountrycode. We are improving the Python port of my marginaleffects package for R. Eventually, the online "book" will be fully bilingual R/Python, like this page:

https://marginaleffects.com/articles/marginaleffects.html

frank113 commented 1 year ago

The R package is quite robust, thanks for the heads up! The bilingual approach seems to be increasingly common in the data world -- curious to see how the split settles.