New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-46296: add a test case for enum.py
which covers _use_args == True
and _member_type_ == object
#30458
Conversation
asyncio test sometimes fails on win, reopening. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The premise is indeed untrue: _use_args_
can be True
when _member_type_ is object
.
The branch is taken under rare conditions with a mixed-in type has a __new__
with a complicated method of determining the value
attribute.
The branch is taken when a custom __new__
has been defined: _use_args_
will then be True
, and if _value_
has not been set then __set_name__
will try to call object.__new__(cls, *args)
which will fail. The if _member_type_ is object
branch is there to set the _value_
attribute, since it can.
@ethanfurman yes, you are right. Now this case is covered. |
enum.py
enum.py
which covers _use_args == True
and _member_type_ == object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Thanks.
Thank you! Several other missing branches left 🙂 |
If I am missing something and
_member_type_
can beobject
while_use_args_
isTrue
, then this PR can be converted into a coverage increasing one.I will just add a sample to cover this case (but, again, I can't come up with one).
https://bugs.python.org/issue46296