runtime
298 / 500
question 298 Packaging & Databases · medium

Tests that catch broken version checks

versions.py holds satisfies(version, spec), the deploy script's version check: every comma-separated condition must hold, versions compare as numbers, and missing parts count as zeros (2.0 equals 2.0.0). It is about to be refactored. Write unittest tests that pass on the current, correct version and would catch the mistakes such a rewrite typically introduces.

Writetests in a unittest.TestCase class (or top-level test_ functions with assert) that call satisfies
Rulesoperators >=, <=, ==, !=, >, <; all conditions must hold; "" accepts anything
Gradedyour tests run against the correct satisfies and against several broken versions; don't call the tests yourself

Loading your progress…

Tests that catch broken version checks — Python practice · Runtime