Skip to content

Commit 5145b18

Browse files
committed
Replace references to draft 3 in a few more doc examples.
1 parent 7d34d51 commit 5145b18

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

jsonschema/protocols.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def is_valid(self, instance: dict) -> bool:
120120
:rtype: bool
121121
122122
>>> schema = {"maxItems" : 2}
123-
>>> Draft3Validator(schema).is_valid([2, 3, 4])
123+
>>> Draft202012Validator(schema).is_valid([2, 3, 4])
124124
False
125125
"""
126126

@@ -136,7 +136,7 @@ def iter_errors(self, instance: dict) -> Iterator[ValidationError]:
136136
... "items" : {"enum" : [1, 2, 3]},
137137
... "maxItems" : 2,
138138
... }
139-
>>> v = Draft3Validator(schema)
139+
>>> v = Draft202012Validator(schema)
140140
>>> for error in sorted(v.iter_errors([2, 3, 4]), key=str):
141141
... print(error.message)
142142
4 is not one of [1, 2, 3]
@@ -151,7 +151,7 @@ def validate(self, instance: dict) -> None:
151151
instance is invalid
152152
153153
>>> schema = {"maxItems" : 2}
154-
>>> Draft3Validator(schema).validate([2, 3, 4])
154+
>>> Draft202012Validator(schema).validate([2, 3, 4])
155155
Traceback (most recent call last):
156156
...
157157
ValidationError: [2, 3, 4] is too long

jsonschema/tests/test_validators.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,18 +269,6 @@ def test_multiple_type_failure(self):
269269
message = self.message_for(instance=1, schema={"type": list(types)})
270270
self.assertEqual(message, "1 is not of type 'string', 'object'")
271271

272-
def test_object_without_title_type_failure(self):
273-
type = {"type": [{"minimum": 3}]}
274-
message = self.message_for(
275-
instance=1,
276-
schema={"type": [type]},
277-
cls=validators.Draft3Validator,
278-
)
279-
self.assertEqual(
280-
message,
281-
"1 is not of type {'type': [{'minimum': 3}]}",
282-
)
283-
284272
def test_object_with_named_type_failure(self):
285273
schema = {"type": [{"name": "Foo", "minimum": 3}]}
286274
message = self.message_for(
@@ -308,6 +296,18 @@ def test_dependencies_single_element(self):
308296
)
309297
self.assertEqual(message, "'foo' is a dependency of 'bar'")
310298

299+
def test_object_without_title_type_failure_draft3(self):
300+
type = {"type": [{"minimum": 3}]}
301+
message = self.message_for(
302+
instance=1,
303+
schema={"type": [type]},
304+
cls=validators.Draft3Validator,
305+
)
306+
self.assertEqual(
307+
message,
308+
"1 is not of type {'type': [{'minimum': 3}]}",
309+
)
310+
311311
def test_dependencies_list_draft3(self):
312312
depend, on = "bar", "foo"
313313
schema = {"dependencies": {depend: [on]}}

0 commit comments

Comments
 (0)