summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorGlenn Maynard <glenn@zewt.org>2012-05-31 16:42:01 +0000
committerGlenn Maynard <glenn@zewt.org>2012-05-31 16:42:01 +0000
commit716d797a69385095b02c2f81bf652ebe7d8025de (patch)
tree549c9b106732ea551589da989f38b1ff7faa8f47 /tests.py
parent2c0ff4f0d2f4accc6589d9bfb5bcbdc02fcfc2d3 (diff)
downloadjsonschema-716d797a69385095b02c2f81bf652ebe7d8025de.tar.gz
Fix "items" verification.
Like "properties", "items" was failing: jsonschema.validate(1, {'type': ['number', 'array'], 'items': {'type': 'string'}}) (The regression tests I'm adding for these can probably be done more concisely.)
Diffstat (limited to 'tests.py')
-rw-r--r--tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index 7ec9ab8..9905481 100644
--- a/tests.py
+++ b/tests.py
@@ -198,6 +198,17 @@ class TestValidate(ParameterizedTestCase, unittest.TestCase):
("null", "invalid", None),
)(validation_test(type=["integer", "object"], properties={'x': {}}))
+ multiple_types_with_items = parametrized(
+ ("integer", "valid", 1),
+ ("string", "invalid", "foo"),
+ ("number", "invalid", 1.1),
+ ("object", "invalid", {}),
+ ("array", "valid", ["x"]),
+ ("object", "invalid", {'x': 10}),
+ ("boolean", "invalid", True),
+ ("null", "invalid", None),
+ )(validation_test(type=["integer", "array"], items={"type": "string"}))
+
multiple_types_schema = parametrized(
("match", "valid", [1, 2]),
("other_match", "valid", {"foo" : "bar"}),