You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
E hypothesis.errors.ResolutionFailed: Could not resolve ForwardRef('Optional[Union[int, Dummy]]') to a strategy; consider using register_type_strategy
.../site-packages/hypothesis/strategies/_internal/types.py:442: ResolutionFailed
Extra info:
Python 3.8
pydantic 1.10.2
hypothesis 6.58
pytest 7.0.1
The text was updated successfully, but these errors were encountered:
digging even further, I think this is because Hypothesis prioritizes the annotations in a .__signature__ attribute over the results of typing.get_type_hints(). That still seems correct in general, but arguably we shouldn't do so when the new value is a ForwardRef and there's an existing non-forward-ref annotation.
I would like to use hypothesis to generate instances of pydantic models, but it looks like it cannot handle recursive models with ForwardRefs.
(Quite) minimal example triggering the problem:
When running this with pytest, it fails with:
Extra info:
The text was updated successfully, but these errors were encountered: