summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests.py')
-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})