Testing and Code Quality
Write tests with assert, pytest, mocks and doctest, measure coverage, lint and format with Ruff, and let pre-commit and CI check every change for you.
Code that runs is not the same as code that is right. This phase teaches the habit that separates hobby scripts from software people can depend on: write a small program that checks your program. You start with a plain assert, move to pytest (the tool almost every Python project uses), and learn fixtures, parametrised tests, and mocks and fakes for code that talks to the network, the clock or an AI model.
Then you look at the quality of the code itself. Ruff finds bugs and style problems and formats code in milliseconds, coverage shows which lines your tests never touched (and, just as important, what it cannot prove), and test-driven development and property-based testing give you two ways to find bugs you did not think of.
The phase ends by making all of it automatic: pre-commit hooks stop bad code before it is committed, and a GitHub Actions workflow runs the tests, the linter and the type checker on every push, on several Python versions. After this phase you can change code with confidence, which is the skill every later phase (and every real job) needs.
Practise this phase
Hands-on exercises: write the code, run it, and press Check to have it tested automatically.