Unit 14 · overview
Unit 14: Testing & Reliable Code
A program running once is an observation. A test is a repeatable claim about behavior.
The difference matters the moment you change the code.
Convert expectations into executable evidence
You will move from manual checks to assertions and automated tests. The central comparison is always:
given input/state
-> execute behavior
-> actual result
-> compare with expected result
Good tests do more than confirm the happy path. They probe boundaries, invalid input, empty data, failure behavior, and cases that previously produced bugs.
This Unit introduces pytest, expected exceptions, test discovery, readable failure reports, regression tests, and the design changes that make code easier to test. You will separate logic from interactive I/O so a function can be exercised without a human typing into every test run.
The suite has to earn trust
Your evidence is a small test suite tied to explicit behavior. Include at least one normal case, one exact boundary, one failure/exception case, and one regression test created from a bug or intentionally broken implementation.
The goal is not the largest number of green tests. The goal is knowing what each passing test actually proves and what it still does not prove.