diff options
Diffstat (limited to 'jsonschema')
-rw-r--r-- | jsonschema/cli.py | 9 | ||||
-rw-r--r-- | jsonschema/tests/test_cli.py | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/jsonschema/cli.py b/jsonschema/cli.py index f93b5c5..1292b1a 100644 --- a/jsonschema/cli.py +++ b/jsonschema/cli.py @@ -251,11 +251,12 @@ def run(arguments, stdout=sys.stdout, stderr=sys.stderr, stdin=sys.stdin): except _CannotLoadFile: return 1 - if arguments["validator"] is None: - arguments["validator"] = validator_for(schema) + Validator = arguments["validator"] + if Validator is None: + Validator = validator_for(schema) try: - arguments["validator"].check_schema(schema) + Validator.check_schema(schema) except SchemaError as error: outputter.validation_error( instance_path=arguments["schema"], @@ -281,7 +282,7 @@ def run(arguments, stdout=sys.stdout, stderr=sys.stderr, stdin=sys.stdin): referrer=schema, ) if arguments["base_uri"] is not None else None - validator = arguments["validator"](schema, resolver=resolver) + validator = Validator(schema, resolver=resolver) exit_code = 0 for each in instances: try: diff --git a/jsonschema/tests/test_cli.py b/jsonschema/tests/test_cli.py index 9011a76..64f77b0 100644 --- a/jsonschema/tests/test_cli.py +++ b/jsonschema/tests/test_cli.py @@ -762,7 +762,7 @@ class TestCLI(TestCase): error = str(e.exception) self.assertIn(f"{os.sep}someNonexistentFile.json'", error) - def test_invalid_exlicit_base_uri(self): + def test_invalid_explicit_base_uri(self): schema = '{"$ref": "foo.json#definitions/num"}' instance = "1" |