pytest: Don’t Assume. Test your Python Code

pytest: Don’t Assume. Test your Python Code

When working on a data science project, don’t assume that the output will be what you expect. Test your assumption. The easiest way to do that in Python is pytest.

For example, in the code above, I use pytest to test my assumption about the output of the text. When running pytest file_name.py, pytest will run the functions that start with test_.

By running the test, I know where can my function goes wrong.

Check out other examples in my article about pytest.

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran