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(
9797) -> st .SearchStrategy [str ]:
9898 def check_valid (string : str ) -> str :
9999 try :
100- assert isinstance (string , str )
100+ if not isinstance (string , str ):
101+ raise jsonschema .FormatError (f"{ string !r} is not a string" )
101102 checker .check (string , format = format_name )
102- except ( AssertionError , jsonschema .FormatError ) as err :
103+ except jsonschema .FormatError as err :
103104 raise InvalidArgument (
104105 f"Got string={ string !r} from strategy { strategy !r} , but this "
105106 f"is not a valid value for the { format_name !r} checker."
@@ -136,8 +137,6 @@ def __from_schema(
136137 format_checker = jsonschema .FormatChecker ()
137138 custom_formats = {
138139 name : _get_format_filter (name , format_checker , strategy )
139- if name in format_checker .checkers
140- else strategy
141140 for name , strategy in custom_formats .items ()
142141 }
143142 custom_formats [_FORMATS_TOKEN ] = None # type: ignore
You can’t perform that action at this time.
0 commit comments