File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,24 @@ that matches some [JSON schema](https://json-schema.org/).
10
10
The public API consists of just one function: ` hypothesis_jsonschema.from_schema ` ,
11
11
which takes a JSON schema and returns a strategy for allowed JSON objects.
12
12
13
+ ``` python
14
+ from hypothesis import given
15
+ from hypothesis_jsonschema import from_schema
16
+
17
+ @given (from_schema(
18
+ {" type" : " integer" , " minimum" : 1 , " exclusiveMaximum" : 10 }
19
+ ))
20
+ def test (value ):
21
+ assert isinstance (value, int )
22
+ assert 1 <= value < 10
23
+ ```
24
+
25
+ For more details on property-based testing and how to use or customise
26
+ strategies, [ see the Hypothesis docs] ( https://hypothesis.readthedocs.io/ ) .
27
+
13
28
JSONSchema drafts 04, 05, and 07 are fully tested and working.
14
29
As of version 0.11, this includes resolving non-recursive references!
15
30
16
- For details on how to use this strategy in your tests,
17
- [ see the Hypothesis docs] ( https://hypothesis.readthedocs.io/ ) .
18
-
19
31
20
32
## Supported versions
21
33
You can’t perform that action at this time.
0 commit comments