4 · 12 lessons

Testing in Python

Clear assertions, pytest discovery, fixtures and parametrize, then mocks, fakes, controlled time, property-style tests and doctest.

Progress and your code are kept in this browser only.

  1. 1Arrange, act, assert
  2. 2How pytest finds tests
  3. 3Fixtures
  4. 4Parametrize
  5. 5Testing exceptions in detail
  6. 6Files with tmp_path
  7. 7Mock and patch
  8. 8monkeypatch
  9. 9Fakes versus mocks
  10. 10Property-style tests by hand
  11. 11Doctest
  12. 12Testing a class through its behaviour