[Python-Dev] Best practices for Enum

Gregory P. Smith greg at krypto.org
Tue May 14 18:39:10 CEST 2013


Bad: doctests.


On Tue, May 14, 2013 at 5:08 AM, Steven D'Aprano <steve at pearwood.info>wrote:

> On 14/05/13 16:51, Gregory P. Smith wrote:
> [...]
>
>  This sounds like a feature request for doctest.  doctest could be educated
>> about enums and automatically compare to the integer value for such cases.
>>
>
> Please no. Enums are not special enough to break the rules.
>
> Good: "Doctests look at the object's repr."
>
> Bad: "Doctests look at an object's repr, unless the object is an Enum,
> when it will look at the enum's value."
>
> If I want a test that checks the enum's value, then I will write a doctest
> that explicitly checks the enum's value.
>
>
>
> --
> Steven
>
> ______________________________**_________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/**mailman/listinfo/python-dev<http://mail.python.org/mailman/listinfo/python-dev>
> Unsubscribe: http://mail.python.org/**mailman/options/python-dev/**
> greg%40krypto.org<http://mail.python.org/mailman/options/python-dev/greg%40krypto.org>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130514/d1815ef9/attachment.html>


More information about the Python-Dev mailing list