File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
src/check_jsonschema/schema_loader Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 55import typing as t
66import urllib .error
77import urllib .parse
8+ from abc import ABC
89
910import jsonschema
1011
@@ -59,7 +60,7 @@ def _extend_with_pattern_implementation(
5960 )
6061
6162
62- class SchemaLoaderBase :
63+ class SchemaLoaderBase ( ABC ) :
6364 def get_validator (
6465 self ,
6566 path : pathlib .Path | str ,
@@ -68,7 +69,7 @@ def get_validator(
6869 regex_impl : RegexImplementation ,
6970 fill_defaults : bool ,
7071 ) -> jsonschema .protocols .Validator :
71- raise NotImplementedError
72+ pass
7273
7374
7475class SchemaLoader (SchemaLoaderBase ):
Original file line number Diff line number Diff line change 1+ import jsonschema
2+ import pytest
3+
4+ from check_jsonschema .builtin_schemas import get_builtin_schema
5+ from check_jsonschema .cli .main_command import BUILTIN_SCHEMA_NAMES
6+ from check_jsonschema .regex_variants import RegexImplementation , RegexVariantName
7+ from check_jsonschema .schema_loader .main import _check_schema
8+
9+
10+ @pytest .mark .parametrize ("name" , BUILTIN_SCHEMA_NAMES )
11+ def test_check_schema_builtin (name ):
12+ """
13+ Test that the buildin schema is valid
14+ """
15+ regex_impl = RegexImplementation (RegexVariantName .default )
16+ schema = get_builtin_schema (name )
17+
18+ # get the correct validator class and check the schema under its metaschema
19+ validator_cls = jsonschema .validators .validator_for (schema )
20+ _check_schema (validator_cls , schema , regex_impl = regex_impl )
You can’t perform that action at this time.
0 commit comments