Intro
I was doing some python tests recently I came to use python asserts again, np_asserts, python asserts and unittest framework. All very very useful, but I think the original assert is so clever and easy to use, we should apply them in everyday life.
asserts
np library
Np is also so straightforward, just need to do import numpy as np and it’s done! Put the comparison, and done!
Comparing arrays for example:
unittest
That’s a complete framework for testing and it’s very simple and has set_up, and tear_down. All in it.
python -m unittest -v test_module
You can add some verbosity via –v while doing the execution
Source
https://github.com/FranciscoMeloJr/Python-Tests/tree/master/
REFs
[1]https://code-maven.com/slides/python-programming/pytest-compare-strings
[2]https://docs.scipy.org/doc/numpy-1.13.0/reference/routines.testing.html
[3] https://docs.python.org/3/library/unittest.html (for python 3)