Lesson 5: Tests that catch the day-31 bug
20 min read·13 Oct 2026
Module 10 · Lesson 5 · About 45 minutes · Needs: Module 1, Lesson 3 (pytest basics) and Lesson 1 of this module (routes, Pydantic models, dependencies)
The situation
Dev has two routes: one says whether an order can be returned, one asks the model to answer the customer. Both rest on the 30-day rule, and someone will refactor it next week. Dev wants tests that run in seconds, need no API key, and fail if the rule shifts by a day.
The running example is Aisha Rahman's order 6150, GlowLine bulbs delivered on 4 October 2026. Day 30, 3 November, is in. Day 31, 4 November, is out.