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.
12
12
13
13
``` python
14
14
from hypothesis import given
15
+
15
16
from hypothesis_jsonschema import from_schema
16
17
17
18
18
- @given (from_schema(
19
- {" type" : " integer" , " minimum" : 1 , " exclusiveMaximum" : 10 }
20
- ))
19
+ @given (from_schema({" type" : " integer" , " minimum" : 1 , " exclusiveMaximum" : 10 }))
21
20
def test_integers (value ):
22
21
assert isinstance (value, int )
23
22
assert 1 <= value < 10
24
23
25
24
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
+ )
32
33
def test_card_numbers (value ):
33
34
assert isinstance (value, str )
34
35
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