Skip to content

Improve error message for from_type(Type["int"])#2892

Merged
Zac-HD merged 2 commits intoHypothesisWorks:masterfrom
Zac-HD:forwardref-error-msg
Mar 9, 2021
Merged

Improve error message for from_type(Type["int"])#2892
Zac-HD merged 2 commits intoHypothesisWorks:masterfrom
Zac-HD:forwardref-error-msg

Conversation

@Zac-HD
Copy link
Copy Markdown
Member

@Zac-HD Zac-HD commented Mar 8, 2021

Sadly this closes #2565, because Type objects don't track the module they were defined in - and we therefore can't get the globals in which to look up the forward reference.

Upside, at least I managed to improve the error message and write a covering test 😕

@Zac-HD Zac-HD added the legibility make errors helpful and Hypothesis grokable label Mar 8, 2021
@Zac-HD Zac-HD requested a review from sobolevn March 8, 2021 01:07
Copy link
Copy Markdown
Member

@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.

Thank you! 👍

Sadly, the ForwardRef implementation is far from ideal 😞

@Zac-HD Zac-HD force-pushed the forwardref-error-msg branch from bd6f2a0 to fdabf59 Compare March 9, 2021 06:49
@Zac-HD Zac-HD requested a review from sobolevn March 9, 2021 07:16
Copy link
Copy Markdown
Member

@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.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

legibility make errors helpful and Hypothesis grokable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fails on typing.Type and ForwardRef

2 participants