[Python-Dev] doctest and pickle (original) (raw)

Serhiy Storchaka storchaka at gmail.com
Sat Jun 8 10:07:11 CEST 2013


08.06.13 10:03, Ethan Furman написав(ла):

Indeed, and it is already in several different ways. But it would be nice to have a pickle example in the docs that worked with doctest.

I ended up doing what Barry did: >>> from test.testenum import Fruit >>> from pickle import dumps, loads >>> Fruit.tomato is loads(dumps(Fruit.tomato)) True

I think that the documentation is there for people. If you need tests, add them separately, but the documentation should be clear and understandable. 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.



More information about the Python-Dev mailing list