summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorJulian Berman <Julian+git@GrayVines.com>2011-12-31 19:47:08 -0500
committerJulian Berman <Julian+git@GrayVines.com>2011-12-31 19:47:08 -0500
commit34ff653e3b3a0eea199299a12b18f5faa4c7508b (patch)
tree19f40904f861d08cac8ec21e32e27d9b22f9425a /tests.py
parent49d3bb3dc015fe0cc231e5a15efa777571716b55 (diff)
downloadjsonschema-34ff653e3b3a0eea199299a12b18f5faa4c7508b.tar.gz
disallowed
Diffstat (limited to 'tests.py')
-rw-r--r--tests.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index ba8061f..3f6da0a 100644
--- a/tests.py
+++ b/tests.py
@@ -256,4 +256,27 @@ class TestValidate(unittest.TestCase):
self.validate_test([.75], [.751], divisibleBy=.01)
self.validate_test([3.3], [3.5], divisibleBy=1.1)
+ def test_disallow(self):
+ self.validate_test([u"foo"], [1], disallow=u"integer")
+
+ def test_multiple_disallow(self):
+ self.validate_test(
+ [u"foo"],
+ [1, True],
+ disallow=[u"integer", u"boolean"]
+ )
+
+ def test_multiple_disallow_subschema(self):
+ schema = {
+ "disallow" : [
+ u"string", {"properties" : {u"foo" : {u"type" : u"string"}}}
+ ],
+ }
+
+ self.validate_test(
+ [1, {u"foo" : 1}],
+ [u"string", {u"foo" : u"string"}],
+ **schema
+ )
+
# Test that only the types that are json-loaded validate (e.g. bytestrings)