Caffeinated Coder
Book an appointment
Lesson 26 · Idiomatic Python

Testing with pytest

A test is a small function that calls your code and checks the answer with assert. pytest is the tool that finds those functions, runs each one and reports what happened. Follow one run of test_area.py: one test passes by luck, the other fails, pytest's report points straight at a typo, and after the fix both tests pass.

14 min11 steps5 questionsAdvanced
Fig 26 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.