summaryrefslogtreecommitdiff
path: root/jsonschema
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-08-16 10:57:50 +0300
committerJulian Berman <Julian@GrayVines.com>2022-08-16 10:57:50 +0300
commit5145b185f56701c77e0010f42a2eefee6e414f9d (patch)
tree90f265d35eed3b1bd73e47ac0725a167bcd4adf5 /jsonschema
parent7d34d5133811ef146266d5e186bd199b6befc54c (diff)
downloadjsonschema-5145b185f56701c77e0010f42a2eefee6e414f9d.tar.gz
Replace references to draft 3 in a few more doc examples.
Diffstat (limited to 'jsonschema')
-rw-r--r--jsonschema/protocols.py6
-rw-r--r--jsonschema/tests/test_validators.py24
2 files changed, 15 insertions, 15 deletions
diff --git a/jsonschema/protocols.py b/jsonschema/protocols.py
index 16bfb69..0e96eff 100644
--- a/jsonschema/protocols.py
+++ b/jsonschema/protocols.py
@@ -120,7 +120,7 @@ class Validator(Protocol):
:rtype: bool
>>> schema = {"maxItems" : 2}
- >>> Draft3Validator(schema).is_valid([2, 3, 4])
+ >>> Draft202012Validator(schema).is_valid([2, 3, 4])
False
"""
@@ -136,7 +136,7 @@ class Validator(Protocol):
... "items" : {"enum" : [1, 2, 3]},
... "maxItems" : 2,
... }
- >>> v = Draft3Validator(schema)
+ >>> v = Draft202012Validator(schema)
>>> for error in sorted(v.iter_errors([2, 3, 4]), key=str):
... print(error.message)
4 is not one of [1, 2, 3]
@@ -151,7 +151,7 @@ class Validator(Protocol):
instance is invalid
>>> schema = {"maxItems" : 2}
- >>> Draft3Validator(schema).validate([2, 3, 4])
+ >>> Draft202012Validator(schema).validate([2, 3, 4])
Traceback (most recent call last):
...
ValidationError: [2, 3, 4] is too long
diff --git a/jsonschema/tests/test_validators.py b/jsonschema/tests/test_validators.py
index c2744a3..0643362 100644
--- a/jsonschema/tests/test_validators.py
+++ b/jsonschema/tests/test_validators.py
@@ -269,18 +269,6 @@ class TestValidationErrorMessages(TestCase):
message = self.message_for(instance=1, schema={"type": list(types)})
self.assertEqual(message, "1 is not of type 'string', 'object'")
- def test_object_without_title_type_failure(self):
- type = {"type": [{"minimum": 3}]}
- message = self.message_for(
- instance=1,
- schema={"type": [type]},
- cls=validators.Draft3Validator,
- )
- self.assertEqual(
- message,
- "1 is not of type {'type': [{'minimum': 3}]}",
- )
-
def test_object_with_named_type_failure(self):
schema = {"type": [{"name": "Foo", "minimum": 3}]}
message = self.message_for(
@@ -308,6 +296,18 @@ class TestValidationErrorMessages(TestCase):
)
self.assertEqual(message, "'foo' is a dependency of 'bar'")
+ def test_object_without_title_type_failure_draft3(self):
+ type = {"type": [{"minimum": 3}]}
+ message = self.message_for(
+ instance=1,
+ schema={"type": [type]},
+ cls=validators.Draft3Validator,
+ )
+ self.assertEqual(
+ message,
+ "1 is not of type {'type': [{'minimum': 3}]}",
+ )
+
def test_dependencies_list_draft3(self):
depend, on = "bar", "foo"
schema = {"dependencies": {depend: [on]}}