P
Pete Forman
André said:> Ok, doctest-based version of the Unit test example added; so much
> more Pythonic ;-)
Sorry for being a bit picky but there are a number of things that I'm
unhappy with in that example.
1) It's the second example with 13 lines. Though I suppose that the
pragmatism of pairing the examples overriding an implicit goal of
the page is itself Pythonic.
2) assert is not the simplest example of doctest. The style should be
0.0>>> add_money([0.13, 0.02]) 0.15
>>> add_money([100.01, 99.99]) 200.0
>>> add_money([0, -13.00, 13.00])
3) which fails :-( So both the unittest and doctest examples ought to
be redone to emphasize what they are doing without getting bogged
down by issues of floating point representations.
http://wiki.python.org/moin/SimplePrograms