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

Resolves strategies from Annotated type #3082

Merged
merged 2 commits into from Sep 6, 2021
Merged

Resolves strategies from Annotated type #3082

merged 2 commits into from Sep 6, 2021

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Sep 3, 2021

Refs #2978

@sobolevn
Copy link
Member Author

sobolevn commented Sep 3, 2021

I want to see how this behaves accross multiple Python versions. SInce it works for 3.8

@sobolevn
Copy link
Member Author

sobolevn commented Sep 3, 2021

Ok, @Zac-HD there's a small problem: https://github.com/HypothesisWorks/hypothesis/pull/3082/checks?check_run_id=3507228624

It fails because this line here

uses get_type_hints() directly, which returns {x: integers()} in 3.9

@Zac-HD
Copy link
Member

Zac-HD commented Sep 6, 2021

uses get_type_hints() directly, which returns {x: integers()} in 3.9

Nope, that's not the reason! It's failing because get_type_hints will only return the type-being-annotated unless you use the new include_extras=True argument, which I've now added 😁

Copy link
Member Author

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your help! I was pretty much stuck with it 🙂

@@ -81,28 +81,25 @@ def get_type_hints(thing):
Never errors: instead of raising TypeError for uninspectable objects, or
NameError for unresolvable forward references, just return an empty dict.
"""
kwargs = {} if sys.version_info[:2] < (3, 9) else {"include_extras": True}
Copy link
Member Author

Choose a reason for hiding this comment

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

I was not aware of this hack! Oh wow!

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

Let's ship it!

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.

None yet

2 participants