File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -12,23 +12,24 @@ which takes a JSON schema and returns a strategy for allowed JSON objects.
1212
1313``` python
1414from hypothesis import given
15+
1516from hypothesis_jsonschema import from_schema
1617
1718
18- @given (from_schema(
19- {" type" : " integer" , " minimum" : 1 , " exclusiveMaximum" : 10 }
20- ))
19+ @given (from_schema({" type" : " integer" , " minimum" : 1 , " exclusiveMaximum" : 10 }))
2120def test_integers (value ):
2221 assert isinstance (value, int )
2322 assert 1 <= value < 10
2423
2524
26- @given (from_schema(
27- {" type" : " string" , " format" : " card" },
28- # Standard formats work out of the box. Custom formats are ignored
29- # by default, but you can pass custom strategies for them - e.g.
30- custom_formats = {" card" : st.sampled_from(EXAMPLE_CARD_NUMBERS )}
31- ))
25+ @given (
26+ from_schema(
27+ {" type" : " string" , " format" : " card" },
28+ # Standard formats work out of the box. Custom formats are ignored
29+ # by default, but you can pass custom strategies for them - e.g.
30+ custom_formats = {" card" : st.sampled_from(EXAMPLE_CARD_NUMBERS )},
31+ )
32+ )
3233def test_card_numbers (value ):
3334 assert isinstance (value, str )
3435 assert re.match(r " ^ \d {4} \d {4} \d {4} \d {4} $ " , value)
You can’t perform that action at this time.
0 commit comments