summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2013-05-21 09:33:45 -0400
committerJulian Berman <Julian@GrayVines.com>2013-05-21 09:33:45 -0400
commitd6f99968a8532bf4518562309383360f3b170889 (patch)
tree248a199923577b3fbd54ed00fcc56fedefeda307
parentaa7601131f647e7425c27d01f0d9213f7ed2328e (diff)
downloadjsonschema-d6f99968a8532bf4518562309383360f3b170889.tar.gz
Remove ValidatorMixin.
-rw-r--r--jsonschema/__init__.py7
-rw-r--r--jsonschema/tests/test_validators.py15
-rw-r--r--jsonschema/validators.py17
3 files changed, 4 insertions, 35 deletions
diff --git a/jsonschema/__init__.py b/jsonschema/__init__.py
index 4514d8f..fa94bfa 100644
--- a/jsonschema/__init__.py
+++ b/jsonschema/__init__.py
@@ -10,18 +10,17 @@ instance under a schema, and will create a validator for you.
"""
from jsonschema.exceptions import (
- FormatError, RefResolutionError, SchemaError, UnknownType, ValidationError
+ FormatError, RefResolutionError, SchemaError, ValidationError
)
from jsonschema._format import (
FormatChecker, draft3_format_checker, draft4_format_checker,
)
from jsonschema.validators import (
- ErrorTree, Draft3Validator, Draft4Validator, RefResolver, ValidatorMixin,
- validate, validates,
+ ErrorTree, Draft3Validator, Draft4Validator, RefResolver, validate
)
-__version__ = "1.5.0-dev"
+__version__ = "2.0.0"
# flake8: noqa
diff --git a/jsonschema/tests/test_validators.py b/jsonschema/tests/test_validators.py
index afa472d..ac88432 100644
--- a/jsonschema/tests/test_validators.py
+++ b/jsonschema/tests/test_validators.py
@@ -9,8 +9,7 @@ from jsonschema.compat import PY3
from jsonschema.tests.compat import mock, unittest
from jsonschema.validators import (
RefResolutionError, UnknownType, ErrorTree, Draft3Validator,
- Draft4Validator, RefResolver, ValidatorMixin, create, extend,
- validator_for, validate,
+ Draft4Validator, RefResolver, create, extend, validator_for, validate,
)
@@ -678,18 +677,6 @@ class TestValidate(unittest.TestCase):
chk_schema.assert_called_once_with({})
-class TestValidatorMixin(unittest.TestCase):
- def test_if_ref_is_present_then_the_schema_is_replaced(self):
- class Validator(ValidatorMixin):
- validate_ref = mock.Mock(return_value=[])
- validate_type = mock.Mock(return_value=[])
-
- Validator({"$ref" : "foo", "type" : "quux"}).validate(1)
-
- self.assertTrue(Validator.validate_ref.called)
- self.assertFalse(Validator.validate_type.called)
-
-
class TestRefResolver(unittest.TestCase):
base_uri = ""
diff --git a/jsonschema/validators.py b/jsonschema/validators.py
index 32ad9b2..dcc500e 100644
--- a/jsonschema/validators.py
+++ b/jsonschema/validators.py
@@ -158,23 +158,6 @@ def extend(validator, validators, version=None):
)
-class ValidatorMixin(create(meta_schema={})):
- def __init__(self, *args, **kwargs):
- warnings.warn(
- "ValidatorMixin is deprecated. "
- "Use jsonschema.validators.create instead.",
- DeprecationWarning,
- )
- super(ValidatorMixin, self).__init__(*args, **kwargs)
-
- class _VALIDATORS(dict):
- def __missing__(this, key, dflt=None):
- return getattr(self, "validate_" + str(key).lstrip("$"), dflt)
- get = __missing__
-
- self.VALIDATORS = _VALIDATORS()
-
-
Draft3Validator = create(
meta_schema=_utils.load_schema("draft3"),
validators={