Ensure T
and None
are tested for fields with type Optional[T]
#13
Labels
T
and None
are tested for fields with type Optional[T]
#13
As of now, Hypothesis does not seem to guarantee that it actually tests the type for Pydantic model fields with type
Optional[T]
with default valueNone
. It seems to test withNone
only.Using the solution outlined in this issue, we can use hypothesis-jsonschema to generate the required values.
This will require a somewhat large change to both the existing unit tests and the testing regime in general. Any new tests following this change will be required to use hypothesis-jsonschema. We could potentially also make use of
st.register_type_strategy()
to register the type strategy after inferring the strategy from the schema, so that other tests can simply usest.from_type()
The text was updated successfully, but these errors were encountered: