liveBook · Manning

Evaluation suite

As explained in The Quick Python Book, Fourth Edition

A regression test is a repeatable test that checks whether previously working behavior remains correct after code changes.

A test suite is a repeatable collection of inputs used to check whether a module still produces correct results after code changes. A Python module can expose this capability through a test mode. section 11.3

A compact file-based regression test typically follows these steps:

  • Place representative inputs, including boundary values, in a test file. section 11.3
  • Inspect the printed results or save them to a file for checking. section 11.3
  • Rerun the same test whenever the module or its functions change. section 11.3

Number-to-words module

A test file contains values such as 0, 21, 999, and 1,000,000,000,000,000. Running `python n2w.py --test < n2w.tst` prints each input with its expected-looking conversion, exposing the unsupported fifteen-digit case.

How The Quick Python Book, Fourth Edition covers it

How deep it goes
Shows file creation, command-line execution, output checking, and reruns, but does not develop exhaustive testing.
Examples
Uses the n2w.tst input file and number-to-words outputs ranging from zero through fifteen-digit boundary cases.
What it assumes
Assumes familiarity with Python modules, command-line execution, files, and standard-input redirection.
What you can do after
Operate/configure a Python module's test mode and inspect repeatable output after code changes.
How it connects
Connects test suites with Python modules, main functions, command-line options, and file redirection.

Also explained in

Compare how 11 books explain evaluation suite →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Quick Python Book, Fourth Edition. The section links point to the parts of the book it draws on.