Example #1
0
 def test_it_sets_nested_defaults(self):
     data = {}
     schema = {
         "properties" : {
             "foo" : {
                 "default" : {},
                 "properties" : {"bar" : {"default" : []}},
             }
         }
     }
     seep.instantiate(data, schema)
     self.assertEqual(data, {"foo" : {"bar" : []}})
Example #2
0
 def test_it_sets_defaults(self):
     data = {}
     schema = {"properties" : {"foo" : {"default" : 12}}}
     seep.instantiate(data, schema)
     self.assertEqual(data, {"foo" : 12})
Example #3
0
 def test_validation_errors_are_still_errors(self):
     with self.assertRaises(jsonschema.ValidationError):
         seep.instantiate("foo", {"type" : "integer"})
Example #4
0
 def test_identity_instantiate(self):
     data = {"foo" : 12}
     schema = {"properties" : {"foo" : {}}}
     seep.instantiate(data, schema)
     self.assertEqual(data, {"foo" : 12})