예제 #1
0
파일: tests.py 프로젝트: sunu/oppia-test-2
    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()
예제 #2
0
파일: tests.py 프로젝트: sunu/oppia-test-2
 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()