[Python-Dev] doctest and pickle
Ethan Furman
ethan at stoneleaf.us
Sat Jun 8 17:41:00 CEST 2013
On 06/08/2013 03:09 AM, Serhiy Storchaka wrote:
> 08.06.13 11:47, Ethan Furman написав(ла):
>>> In this case it is better to exclude a code example from doctests or
>>> add auxiliary code (i.e. as Steven suggested) to pass the doctest.
>>
>> Are you saying there is something wrong about what I have in place now?
>> I would think that one line showing something you might actually do
>> (importing an Enum from another module) is better than two lines showing
>> esoteric workarounds (importing __main__ and setting an attribute on it).
>
> test.test_enum is not here. The reader should look into the external test module (which may not be supplied along with
> the module and documentation) to understand the example. Or rely on assumptions.
Fair point. But I suppose that if the end-user is running a doc test, it is not too much to require that the other
tests be installed as well. Plus, we definitely have the other tests. :)
> Is it possible to add "invisible" code which doesn't displayed in the resulting documentation, but taken into account by
> doctest?
I have no idea. This is my first time using doctest.
--
~Ethan~
More information about the Python-Dev
mailing list