Checking your account

You can read the lesson while its saved answers and constructions load. Learning controls will open once that work is ready.

One Correct Prediction Did Not Test the Interface

Write What Must Hold Across Many Inputs

BOTIE

A hand-calculated example can tell us what one prediction should be. It cannot list every future request. Some promises are easier to describe as relationships: if the same named measurements arrive in another order, the result should stay the same. Property-based testing starts from such a promise and tries many inputs that could contradict it.

Claessen and Hughes first published QuickCheck in 2000. The tool generated inputs for developer-written properties and helped reduce failures to smaller examples. Hypothesis brings this approach to Python. The useful result is a counterexample: a concrete input that breaks the stated promise. For our model interface, we will begin with the saved-centre mistake, then test whether changing feature order exposes another mistake. Each relationship must follow from the model’s actual behaviour.

Sources for this history