Testing with Pytest for Data Science
summary
Step‑by‑step use of pytest shows actual code, not platitudes: reproduce the Python2 vs Python3 split_bill failure and see tests catch it; run tests locally and on Travis CI across Python versions; use pytest fixtures to load slow data once (three tests drop from ~9s to ~3s); use mock objects to fake a DataFrame shape instead of materializing millions of rows. The tutorial includes runnable examples, a GitHub repo with solutions, and CI logs showing ~200+ unit tests for a real library.
AI-written summary · about
chapters (8)
- 0:00pytest for data science
- 10:20Testing matters in data science
- 20:50Bill splitting example
- 34:57Basic pytest tests
- 41:02Separating tests from code
- 47:31Fixtures for slow tests
- 1:01:23Mocking objects
- 1:12:38Q&A
related talks
01h 29mAdv. Software Testing for Data Scientists
39mUnit Testing for Data Scientists
01h 30mAdvanced Software Testing for Data Scientists
33mUnit Testing with Pytest
28mHow to not pull your hair out while providing data to the business
29mAdopt-a-pytest
30mVisual Testing with PyCharm and pytest
27mWhy I use py.test and maybe you should too
