Esempio n. 1
0
    def test_typed_instance_property(self):
        class StructuredTestModel(ndb.Model):
            typed_instance = TypedInstanceProperty(required=True)

        model = TypedInstance(obj_type='Int', value='Bad value')
        with self.assertRaises(TypeError):
            structured_model = StructuredTestModel(typed_instance=model)

        model.value = 1
        structured_model = StructuredTestModel(typed_instance=model)
        structured_model.put()
Esempio n. 2
0
 def test_typed_instance_class(self):
     """Tests the TypedInstance class."""
     model = TypedInstance(obj_type='Int', value='Bad value')
     with self.assertRaises(TypeError):
         model.put()
     model.value = 1
     model.put()