diff options
author | Glenn Maynard <glenn@zewt.org> | 2012-05-31 16:42:01 +0000 |
---|---|---|
committer | Glenn Maynard <glenn@zewt.org> | 2012-05-31 16:42:01 +0000 |
commit | 716d797a69385095b02c2f81bf652ebe7d8025de (patch) | |
tree | 549c9b106732ea551589da989f38b1ff7faa8f47 /tests.py | |
parent | 2c0ff4f0d2f4accc6589d9bfb5bcbdc02fcfc2d3 (diff) | |
download | jsonschema-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.py | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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"}), |