summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Berman <Julian+git@GrayVines.com>2012-06-03 09:55:22 -0400
committerJulian Berman <Julian+git@GrayVines.com>2012-06-03 09:55:22 -0400
commit5e1f54f61eda289201abc6e11369691d3dc88f8a (patch)
tree7c3b43d73a73434682a997a951a67ebd5892c86d
parentbaef48e7c1b79188071e7695c44daeb6c5cb6b75 (diff)
downloadjsonschema-5e1f54f61eda289201abc6e11369691d3dc88f8a.tar.gz
Moved irrelevant type tests to test_ methods.
-rw-r--r--tests.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/tests.py b/tests.py
index 9e6133d..b53d6ce 100644
--- a/tests.py
+++ b/tests.py
@@ -238,12 +238,6 @@ class TestValidate(ParameterizedTestCase, unittest.TestCase):
}
))
- validate("x", {"type": ["string", "number"], "minimum": 10})
- validate("x", {"type": ["string", "number"], "maximum": 10})
- validate(1, {"type": ["integer", "object"], "properties": {"x": {}}})
- validate(1, {"type": ["integer", "array"], "items": {"type": "string"}})
- validate("x", {"type": ["integer", "string"], "divisibleBy": 10})
-
def test_additionalProperties_allowed_by_default(self):
schema = {
"properties" : {
@@ -639,3 +633,21 @@ class TestValidate(ParameterizedTestCase, unittest.TestCase):
with self.assertRaises(SchemaError):
validate([1], {"minItems" : "1"}) # needs to be an integer
+
+class TestIgnorePropertiesForIrrelevantTypes(unittest.TestCase):
+ def test_minimum(self):
+ validate("x", {"type": ["string", "number"], "minimum": 10})
+
+ def test_maximum(self):
+ validate("x", {"type": ["string", "number"], "maximum": 10})
+
+ def test_properties(self):
+ validate(1, {"type": ["integer", "object"], "properties": {"x": {}}})
+
+ def test_items(self):
+ validate(
+ 1, {"type": ["integer", "array"], "items": {"type": "string"}}
+ )
+
+ def test_divisibleBy(self):
+ validate("x", {"type": ["integer", "string"], "divisibleBy": 10})