File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
src/hypothesis_jsonschema Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,10 @@ def _get_format_filter(
97
97
) -> st .SearchStrategy [str ]:
98
98
def check_valid (string : str ) -> str :
99
99
try :
100
- assert isinstance (string , str )
100
+ if not isinstance (string , str ):
101
+ raise jsonschema .FormatError (f"{ string !r} is not a string" )
101
102
checker .check (string , format = format_name )
102
- except ( AssertionError , jsonschema .FormatError ) as err :
103
+ except jsonschema .FormatError as err :
103
104
raise InvalidArgument (
104
105
f"Got string={ string !r} from strategy { strategy !r} , but this "
105
106
f"is not a valid value for the { format_name !r} checker."
@@ -136,8 +137,6 @@ def __from_schema(
136
137
format_checker = jsonschema .FormatChecker ()
137
138
custom_formats = {
138
139
name : _get_format_filter (name , format_checker , strategy )
139
- if name in format_checker .checkers
140
- else strategy
141
140
for name , strategy in custom_formats .items ()
142
141
}
143
142
custom_formats [_FORMATS_TOKEN ] = None # type: ignore
You can’t perform that action at this time.
0 commit comments