File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ this code, we add the default properties to each object *before* the
150150properties are validated, so the default values themselves will need to
151151be valid under the schema.)
152152
153- .. code-block :: python
153+ .. testcode ::
154154
155155 from jsonschema import Draft7Validator, validators
156156
@@ -205,7 +205,7 @@ defaults.
205205 all of its properties, but only if your schema provides a default
206206 value for the object itself, like so:
207207
208- .. code-block :: python
208+ .. testcode ::
209209
210210 schema = {
211211 "type": "object",
@@ -231,7 +231,7 @@ defaults.
231231 it won't be instantiated at all, much less populated with default
232232 properties.
233233
234- .. code-block :: python
234+ .. testcode ::
235235
236236 del schema["properties"]["outer-object"]["default"]
237237 obj2 = {}
Original file line number Diff line number Diff line change @@ -84,7 +84,9 @@ types as being acceptable for a validator object, then you should update an
8484existing `TypeChecker ` or create a new one. You may then create a new
8585`Validator ` via `jsonschema.validators.extend `.
8686
87- .. code-block :: python
87+ .. testcode ::
88+
89+ from jsonschema import validators
8890
8991 class MyInteger(object):
9092 pass
@@ -97,7 +99,10 @@ existing `TypeChecker` or create a new one. You may then create a new
9799
98100 type_checker = Draft3Validator.TYPE_CHECKER.redefine("number", is_my_int)
99101
100- CustomValidator = extend(Draft3Validator, type_checker = type_checker)
102+ CustomValidator = validators.extend(
103+ Draft3Validator,
104+ type_checker=type_checker,
105+ )
101106 validator = CustomValidator(schema={"type" : "number"})
102107
103108
@@ -129,7 +134,7 @@ which each included validator class implements.
129134For example, if you wanted to validate a schema you created against the
130135Draft 7 meta-schema, you could use:
131136
132- .. code-block :: python
137+ .. testcode ::
133138
134139 from jsonschema import Draft7Validator
135140
You can’t perform that action at this time.
0 commit comments