From 5e1f54f61eda289201abc6e11369691d3dc88f8a Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Sun, 3 Jun 2012 09:55:22 -0400 Subject: Moved irrelevant type tests to test_ methods. --- tests.py | 24 ++++++++++++++++++------ 1 file 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}) -- cgit v1.2.1