예제 #1
0
 def test_constructor_object_id_none(self):
     """Test that setting object_id to None in __new__ is OK and the object ID is set on get
     """
     parent_obj = Container('obj1')
     child_obj = Container.__new__(Container,
                                   parent=parent_obj,
                                   object_id=None)
     self.assertIsNotNone(child_obj.object_id)
예제 #2
0
 def test_constructor(self):
     """Test that constructor properly sets parent and both child and parent have an object_id
     """
     parent_obj = Container('obj1')
     child_obj = Container.__new__(Container, parent=parent_obj)
     self.assertIs(child_obj.parent, parent_obj)
     self.assertIs(parent_obj.children[0], child_obj)
     self.assertIsNotNone(parent_obj.object_id)
     self.assertIsNotNone(child_obj.object_id)