In this video we go over how to use the Python package pytest to implement unit tests using the Astrodynamics with Python repository to go over examples using the Python assert statement, approximately equal function, numpy arrays, warnings, errors, and how to use pytest from the command line by calling it directly or through the Python interpreter.
Link to Astrodynamics with Python GitHub repository: https://github.com/alfonsogonzalez/AWP
Link to LeetCode Algorithms with C++ and Python GitHub repository: https://github.com/alfonsogonzalez/algos
And as a sneak peek to next video, I show one way to utilize the classic Python if _name_ == '__main__' statement to be able to use unit test scripts differently based on if you run the script directly (when _name_ is equal to '__main__' ) vs unit tests (when _name_ does not equal '__main__', it equals the filename without the .py extension since the script is being imported)
#pytest #unittests #pythontutorials