summaryrefslogtreecommitdiff
path: root/docs/validate.rst
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-08-02 13:46:50 +0300
committerJulian Berman <Julian@GrayVines.com>2022-08-02 13:46:50 +0300
commit60bb7b49bf62c0e180e0f1072d034b1a021b9be7 (patch)
tree408cf49124e5cd37c32df47dc3b4b2ac813a78a5 /docs/validate.rst
parent6f18518ebc5855876aab846183c80372e454ac94 (diff)
downloadjsonschema-60bb7b49bf62c0e180e0f1072d034b1a021b9be7.tar.gz
(Re-)enable more doctests.
It is way too easy to silently pass these :( -- specifically, the doctest directive only works for things with >>> prompts.
Diffstat (limited to 'docs/validate.rst')
-rw-r--r--docs/validate.rst11
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/validate.rst b/docs/validate.rst
index abb52cb..f68f2f9 100644
--- a/docs/validate.rst
+++ b/docs/validate.rst
@@ -84,7 +84,9 @@ types as being acceptable for a validator object, then you should update an
existing `TypeChecker` or create a new one. You may then create a new
`Validator` via `jsonschema.validators.extend`.
-.. code-block:: python
+.. testcode::
+
+ from jsonschema import validators
class MyInteger(object):
pass
@@ -97,7 +99,10 @@ existing `TypeChecker` or create a new one. You may then create a new
type_checker = Draft3Validator.TYPE_CHECKER.redefine("number", is_my_int)
- CustomValidator = extend(Draft3Validator, type_checker=type_checker)
+ CustomValidator = validators.extend(
+ Draft3Validator,
+ type_checker=type_checker,
+ )
validator = CustomValidator(schema={"type" : "number"})
@@ -129,7 +134,7 @@ which each included validator class implements.
For example, if you wanted to validate a schema you created against the
Draft 7 meta-schema, you could use:
-.. code-block:: python
+.. testcode::
from jsonschema import Draft7Validator