--- Pete Forman <[EMAIL PROTECTED]> wrote: > André <[EMAIL PROTECTED]> writes: > > > 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. >
Your pickiness is appreciated. :) > 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. > Since you looked at the page, I have corrected that by making the example above it 12 lines, so that's no longer an issue. > 2) assert is not the simplest example of doctest. > The style should be > > >>> add_money([0.13, 0.02]) > 0.15 > >>> add_money([100.01, 99.99]) > 200.0 > >>> add_money([0, -13.00, 13.00]) > 0.0 > That's not clear cut to me. I think vertical conciseness has an advantage for readability, as it means you get to keep more "real" code on the screen. > 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. > I was the one who originally posted the floating point example (with yet another style of unit testing, BTW), and I agree that the subtleties of floating point do kind of cloud the issue. I welcome a better example. What I didn't realize is that there's an actual error. Are you saying the program fails? On which test? ___________________________________________________________________________________ You snooze, you lose. Get messages ASAP with AutoCheck in the all-new Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/newmail_html.html -- http://mail.python.org/mailman/listinfo/python-list