4 ms·
The Doctest approach (https://docs.python.org/2/library/doctest.html https://docs.python.org/2/library/doctest.html) is kind of a way of formalizing the REPL –
by ianbicking 12y ago
The Doctest approach (https://docs.python.org/2/library/doctest.html https://docs.python.org/2/library/doctest.html) is kind of a way of formalizing the REPL – you still essentially have a REPL, but you have the interaction written down in such a way that you can re-run it. Often you can copy-and-paste your REPL interaction into a document and then it's a test. It's a little more work because the computer doesn't know what "close enough" is – so something that includes a timestamp, for instance, causes failures (since it always changes) unless you annotate the expected output a little.