It would be nice to support the following:
from hypothesis import strategies as st
from typing import Union
A = list[Union["A", str]]
# currently: hypothesis.errors.ResolutionFailed: Could not resolve ForwardRef('A') to a strategy
st.from_type(A).example()
Conceptually, this is equivalent to a = st.deferred(lambda: st.lists(a | st.text())).
Considerations:
- redundant (but valid) self-references, like
A = A | str, which should resolve to str. We may need to normalize cycles beforehand.