Skip to content

Commit 5599eb3

Browse files
committed
#782: Fixes failing styles
1 parent 077de98 commit 5599eb3

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

jsonschema/tests/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import sys
1111
import tempfile
1212

13-
from jsonschema import Draft4Validator, Draft7Validator, __version__, cli
13+
from jsonschema import Draft4Validator, Draft202012Validator, __version__, cli
1414
from jsonschema.exceptions import (
1515
RefResolutionError,
1616
SchemaError,
@@ -336,7 +336,7 @@ def test_invalid_schema_multiple_errors(self):
336336

337337
exit_code=1,
338338
stderr="""\
339-
57: 57 is not valid under any of the given schemas
339+
57: 57 is not of type 'object', 'boolean'
340340
""",
341341
)
342342

@@ -776,7 +776,7 @@ def test_it_validates_using_the_latest_validator_when_unspecified(self):
776776
# is hidden inside the CLI, so guard that that's the case, and
777777
# this test will have to be updated when versions change until
778778
# we can think of a better way to ensure this behavior.
779-
self.assertIs(Draft7Validator, _LATEST_VERSION)
779+
self.assertIs(Draft202012Validator, _LATEST_VERSION)
780780

781781
self.assertOutputs(
782782
files=dict(some_schema='{"const": "check"}', some_instance='"a"'),

jsonschema/tests/test_validators.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,12 @@ class TestDraft7Validator(ValidatorTestMixin, TestCase):
11691169
invalid = {"type": "integer"}, "foo"
11701170

11711171

1172+
class TestDraft202012Validator(ValidatorTestMixin, TestCase):
1173+
Validator = validators.Draft202012Validator
1174+
valid = {}, {}
1175+
invalid = {"type": "integer"}, "foo"
1176+
1177+
11721178
class TestValidatorFor(SynchronousTestCase):
11731179
def test_draft_3(self):
11741180
schema = {"$schema": "http://json-schema.org/draft-03/schema"}
@@ -1222,6 +1228,19 @@ def test_draft_7(self):
12221228
validators.Draft7Validator,
12231229
)
12241230

1231+
def test_draft_202012(self):
1232+
schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
1233+
self.assertIs(
1234+
validators.validator_for(schema),
1235+
validators.Draft202012Validator,
1236+
)
1237+
1238+
schema = {"$schema": "https://json-schema.org/draft/2020-12/schema#"}
1239+
self.assertIs(
1240+
validators.validator_for(schema),
1241+
validators.Draft202012Validator,
1242+
)
1243+
12251244
def test_True(self):
12261245
self.assertIs(
12271246
validators.validator_for(True),

0 commit comments

Comments
 (0)