summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2012-12-29 23:55:57 -0500
committerJulian Berman <Julian@GrayVines.com>2012-12-29 23:55:57 -0500
commitf571a54f7319b535f40dc50d42e26900e625a238 (patch)
treedde361c008c26edaa3453850478c478dd4867462 /tests.py
parent59cfa1922986203318d4a81ddee7e7568b619f96 (diff)
downloadjsonschema-f571a54f7319b535f40dc50d42e26900e625a238.tar.gz
Fixed any to accept any type, including unknown ones.
Closes #47
Diffstat (limited to 'tests.py')
-rw-r--r--tests.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index ef5e3cd..efd8ef4 100644
--- a/tests.py
+++ b/tests.py
@@ -86,8 +86,14 @@ class DecimalMixin(object):
validator.validate(invalid)
+class AnyTypeMixin(object):
+ def test_any_type_is_valid_for_type_any(self):
+ validator = self.validator_class({"type" : "any"})
+ validator.validate(mock.Mock())
+
+
@load_json_cases(os.path.join(os.path.dirname(__file__), "json/tests/draft3/"))
-class TestDraft3(TestCase, ByteStringMixin, DecimalMixin):
+class TestDraft3(TestCase, ByteStringMixin, DecimalMixin, AnyTypeMixin):
validator_class = Draft3Validator
# TODO: we're in need of more meta schema tests
@@ -355,6 +361,9 @@ class TestDraft3Validator(TestCase):
def test_is_type_is_false_for_invalid_type(self):
self.assertFalse(self.validator.is_type("foo", "array"))
+ def test_is_type_is_true_for_any_type(self):
+ self.assertTrue(self.validator.is_type(mock.Mock(), "any"))
+
def test_is_type_evades_bool_inheriting_from_int(self):
self.assertFalse(self.validator.is_type(True, "integer"))
self.assertFalse(self.validator.is_type(True, "number"))