-
Notifications
You must be signed in to change notification settings - Fork 575
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
Handle all builtin types in st.from_type()
, including via Type[...]
and ForwardRef(...)
#2899
Conversation
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.
Thanks! 👍
5f54d8d
to
4961225
Compare
assert isinstance(v, t) | ||
|
||
|
||
@pytest.mark.skipif(sys.version_info[:2] == (3, 6), reason="no ForwardRef type") |
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.
I think that compat
hack now handles 3.6
, doesn't it?
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.
Alas, in 3.6 _ForwardRef
requires that it be called on a type
object. For some reason.
See https://github.com/HypothesisWorks/hypothesis/runs/2084980210?check_suite_focus=true for all the failures when I tried 😭
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.
LGTM! 👀
Thanks!
While working on #2892 and #2896, it occurred to me that (absent a registered strategy to the contrary) it's safe to assume that forward-references to the name of a builtin type does in fact refer to that builtin. This PR implements exactly that logic... and registers all the remaining builtin types, so that we can write the obvious tests.