summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Nezbeda <hn@nezhar.com>2021-06-26 07:52:11 +0200
committerHarald Nezbeda <hn@nezhar.com>2021-07-20 17:08:47 +0200
commit95742b4573b81d0b1e3a4f4be8c1f4238689eb6c (patch)
tree45d1165e9f3e49ac840a3b344603ad09067e8df7
parent98b49be3f533c4acaa6524d0adeb384e89002474 (diff)
downloadjsonschema-95742b4573b81d0b1e3a4f4be8c1f4238689eb6c.tar.gz
Julian/jsonschema#782: Fixes failing styles
-rw-r--r--jsonschema/tests/test_cli.py6
-rw-r--r--jsonschema/tests/test_validators.py19
2 files changed, 22 insertions, 3 deletions
diff --git a/jsonschema/tests/test_cli.py b/jsonschema/tests/test_cli.py
index 884a037..ae4f13d 100644
--- a/jsonschema/tests/test_cli.py
+++ b/jsonschema/tests/test_cli.py
@@ -10,7 +10,7 @@ import subprocess
import sys
import tempfile
-from jsonschema import Draft4Validator, Draft7Validator, __version__, cli
+from jsonschema import Draft4Validator, Draft202012Validator, __version__, cli
from jsonschema.exceptions import (
RefResolutionError,
SchemaError,
@@ -336,7 +336,7 @@ class TestCLI(TestCase):
exit_code=1,
stderr="""\
- 57: 57 is not valid under any of the given schemas
+ 57: 57 is not of type 'object', 'boolean'
""",
)
@@ -776,7 +776,7 @@ class TestCLI(TestCase):
# is hidden inside the CLI, so guard that that's the case, and
# this test will have to be updated when versions change until
# we can think of a better way to ensure this behavior.
- self.assertIs(Draft7Validator, _LATEST_VERSION)
+ self.assertIs(Draft202012Validator, _LATEST_VERSION)
self.assertOutputs(
files=dict(some_schema='{"const": "check"}', some_instance='"a"'),
diff --git a/jsonschema/tests/test_validators.py b/jsonschema/tests/test_validators.py
index 81fb28e..fc6a239 100644
--- a/jsonschema/tests/test_validators.py
+++ b/jsonschema/tests/test_validators.py
@@ -1244,6 +1244,12 @@ class TestDraft7Validator(ValidatorTestMixin, TestCase):
invalid = {"type": "integer"}, "foo"
+class TestDraft202012Validator(ValidatorTestMixin, TestCase):
+ Validator = validators.Draft202012Validator
+ valid = {}, {}
+ invalid = {"type": "integer"}, "foo"
+
+
class TestValidatorFor(SynchronousTestCase):
def test_draft_3(self):
schema = {"$schema": "http://json-schema.org/draft-03/schema"}
@@ -1297,6 +1303,19 @@ class TestValidatorFor(SynchronousTestCase):
validators.Draft7Validator,
)
+ def test_draft_202012(self):
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema"}
+ self.assertIs(
+ validators.validator_for(schema),
+ validators.Draft202012Validator,
+ )
+
+ schema = {"$schema": "https://json-schema.org/draft/2020-12/schema#"}
+ self.assertIs(
+ validators.validator_for(schema),
+ validators.Draft202012Validator,
+ )
+
def test_True(self):
self.assertIs(
validators.validator_for(True),