diff options
author | Julian Berman <Julian@GrayVines.com> | 2022-11-29 13:31:59 -0500 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2022-11-29 13:31:59 -0500 |
commit | dbc398245a583cb2366795dc529ae042d10c1577 (patch) | |
tree | cd5612cb979fd25df5c0508e106553394ad1c7a5 /jsonschema/tests | |
parent | 7ebe1614ce0d30e43e34e7543550a6a7420b508f (diff) | |
download | jsonschema-dbc398245a583cb2366795dc529ae042d10c1577.tar.gz |
Fix instantiating validators with cached refs-to-bool schemas.v4.17.3
Closes: #1018
Diffstat (limited to 'jsonschema/tests')
-rw-r--r-- | jsonschema/tests/test_validators.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/jsonschema/tests/test_validators.py b/jsonschema/tests/test_validators.py index 8f8680a..ec76a3e 100644 --- a/jsonschema/tests/test_validators.py +++ b/jsonschema/tests/test_validators.py @@ -1848,6 +1848,21 @@ class TestDraft202012Validator(ValidatorTestMixin, TestCase): invalid = {"type": "integer"}, "foo" +class TestLatestValidator(TestCase): + """ + These really apply to multiple versions but are easiest to test on one. + """ + + def test_ref_resolvers_may_have_boolean_schemas_stored(self): + ref = "someCoolRef" + schema = {"$ref": ref} + resolver = validators.RefResolver("", {}, store={ref: False}) + validator = validators._LATEST_VERSION(schema, resolver=resolver) + + with self.assertRaises(exceptions.ValidationError): + validator.validate(None) + + class TestValidatorFor(TestCase): def test_draft_3(self): schema = {"$schema": "http://json-schema.org/draft-03/schema"} |