[Python-Dev] doctest and pickle

Ethan Furman ethan at stoneleaf.us
Fri Jun 7 19:53:14 CEST 2013


On 06/07/2013 09:54 AM, Olemis Lang wrote:
> On 6/7/13, Ethan Furman <ethan at stoneleaf.us> wrote:
>> Is there a doctest mailing list?  I couldn't find it.
>>
>
> JFTR, Testing-in-Python (TiP) ML should be the right target for
> general purpose questions about testing, considering docs even for
> unittest and doctest
> http://lists.idyll.org/listinfo/testing-in-python

Cool, thanks.


> [...]
>> Any advice on how to make it work?
>>
>> Here's the excerpt:
>>
>> ===============================================================================
>> Pickling
>> --------
>>
>> Enumerations can be pickled and unpickled::
>>
>>       >>> from enum import Enum
>>       >>> class Fruit(Enum):
>>       ...     tomato = 1
>>       ...     banana = 2
>>       ...     cherry = 3
>>       ...
>>       >>> from pickle import dumps, loads
>>       >>> Fruit.tomato is loads(dumps(Fruit.tomato))
>>       True
>>
>
> ... but it seems I'm still getting in tests an instance of Fruit after
> invoking loads (do you ?)

I'm not sure what you mean by "an instance of Fruit" -- you should be getting an instance of Fruit; specifically the 
tomato instance.

--
~Ethan~


More information about the Python-Dev mailing list