[Python-ideas] doctest
Mark Janssen
dreamingforward at gmail.com
Fri Feb 17 22:57:36 CET 2012
I find myself wanting to use doctest for some test-driven development,
and find myself slightly frustrated and wonder if others would be
interested in seeing the following additional functionality in
doctest:
1. Execution context determined by outer-scope doctest defintions.
2. Smart Comparisons that will detect output of a non-ordered type
(dict/set), lift and recast it and do a real comparison.
Without #1, "literate testing" becomes awash with re-defining re-used
variables which, generally, also detracts from exact purpose of the
test -- this creates testdoc noise and the docs become less useful.
Without #2, "readable docs" nicely co-aligning with "testable docs"
tends towards divergence.
Perhaps not enough developers use doctest to care, but I find it one
of the more enjoyable ways to develop python code -- I don't have to
remember test cases nor go through the trouble of setting up
unittests. AND, it encourages agile development. Another user wrote
a while back of even having a built-in test() method. Wouldn't that
really encourage agile developement? And you wouldn't have to muddy
up your code with "if __name__ == "__main__": import doctest, yadda
yadda".
Anyway... of course patches welcome, yes... ;^)
mark
More information about the Python-ideas
mailing list