Skip to content
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

Allow Any types for tuple except handler tests #1639

Merged

Conversation

pdmccormick
Copy link
Contributor

Fixes #1635.

@pdmccormick
Copy link
Contributor Author

@ddfisher


all_types = [] # type: List[Type]
test_types = type.items if isinstance(type, TupleType) else [type]

for ttype in test_types:
if isinstance(ttype, AnyType):
all_types.append(ttype)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just return AnyType() here instead. UnionType.make_simplified_union returns AnyType if any of the types passed to it are AnyType (as it should).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking at your tests, I take it back. The way you're doing it here correctly catches additional non-Exception-derived types that come after an Any.

@ddfisher
Copy link
Collaborator

ddfisher commented Jun 3, 2016

Looks good, thanks!

@ddfisher ddfisher merged commit 89ffeb2 into python:master Jun 3, 2016
@pdmccormick
Copy link
Contributor Author

Thanks @ddfisher!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants