Roundup Robot added the comment:
New changeset 89f6abc2e115 by Ethan Furman in branch 'default':
Close #19252: better test coverage for Enum. Thanks, CliffM
http://hg.python.org/cpython/rev/89f6abc2e115
--
nosy: +python-dev
resolution: - fixed
stage: - committed/rejected
status: open
CliffM added the comment:
Sorry -- I could have been clearer :
The conditional:
if member.value == value:
Is redundant as the tests stand. If you comment it out -- everything works. So
therefore we are missing a test.
The current test works, as red is the first value to pop out of the
Ethan Furman added the comment:
CliffM added the comment:
Sorry -- I could have been clearer :
The conditional:
if member.value == value:
Is redundant as the tests stand. If you comment it out -- everything works.
So therefore we are missing a test.
Are you saying that you are
CliffM added the comment:
Yes it's purely a coverage issue. I must try to be more explicit (rather than
implicit).
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19252
___
Ethan Furman added the comment:
Well, I would say it's half a coverage issue, half a guard against accidental
deletion of the if test. :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19252
New submission from CliffM:
test_nonhash_value tests the lookup of an Enum Member from a value.
The current test does not exercise the iteration over values completely -- the
if-clause being redundant wrt the existing test.
My patch adds an additional test which requires the if-clause.
Ethan Furman added the comment:
I'm not sure what you are talking about. Here's the code:
try:
if value in cls._value2member_map_:
return cls._value2member_map_[value]
except TypeError:
# not there, now do long search -- O(n) behavior
for member in