diff options
author | Julian Berman <Julian+git@GrayVines.com> | 2011-12-31 19:47:08 -0500 |
---|---|---|
committer | Julian Berman <Julian+git@GrayVines.com> | 2011-12-31 19:47:08 -0500 |
commit | 34ff653e3b3a0eea199299a12b18f5faa4c7508b (patch) | |
tree | 19f40904f861d08cac8ec21e32e27d9b22f9425a /tests.py | |
parent | 49d3bb3dc015fe0cc231e5a15efa777571716b55 (diff) | |
download | jsonschema-34ff653e3b3a0eea199299a12b18f5faa4c7508b.tar.gz |
disallowed
Diffstat (limited to 'tests.py')
-rw-r--r-- | tests.py | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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) |