The scriptdoctest module searches for pieces of text that look like interactive shell sessions, and then executes those sessions to verify that they work exactly as shown.
It was inspired by attempts to write a beastling tutorial that would not immediately become obsolete – see lmaurits/BEASTling#59 – and would never have come to life without doctest.