pytest for Unit Testing in Python | How to Python 2 | Python Tutorials

preview_player
Показать описание
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.

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
Рекомендации по теме
Комментарии
Автор

Im now finishing my engineering degree, and I would like to do something with orbital mechanics and warfare simulation for my masters. I would like to start this early so basically in like 2 months after I finish me eng degree. Do you maybe have a Discord community server or something like that so I could stay in touch? I love your vids and you seem to know everything I would like to learn :)

zaspanyflegmatyk
welcome to shbcf.ru