doctest: address in output

Paramjit Oberoi p_s_oberoi at hotmail.com
Wed May 5 20:38:12 EDT 2004


>     >> >     >>> mymodule.do_something()
>     >> >     <mymodule.coolObj object at ...>
> 
>     Param> The return value of the function is designed to be ignored in
>     Param> normal use.
> 
> Then make it return None and use a different function on those presumably
> rare occasions where you need it.

I may realize later that the interface is inappropriate; but I don't want
to change it because of what the testing framework wants. (Yes, difficulty
in testing often hints at problems in the code, but in this particular
case I think the problem is in the testing framework)

> Maybe not if the "test" part of "doctest" is more important than the "doc"
> part.

I started writing it as documentation, and then realized that it could be
made to do double duty for testing.  And, it could be checked
automatically so that it didn't become inaccurate.

Anyway, the patch I posted works for me.  It could be made more robust
and/or general in case other people are interested.

-param



More information about the Python-list mailing list