예제 #1
0
 def test_raise_on_invalid_weakref(self):
     obj = ObjectWithDel()
     method = utils.weakmethod(obj.public)
     obj.public = method
     self.assertEquals(obj.public(), ("public", (), {}))
     del obj
     self.assertRaises(utils.InvalidatedWeakRef, method)
예제 #2
0
파일: utilsTests.py 프로젝트: rexhsu/vdsm
 def test_raise_on_invalid_weakref(self):
     obj = ObjectWithDel()
     method = utils.weakmethod(obj.public)
     obj.public = method
     self.assertEquals(obj.public(), ("public", (), {}))
     del obj
     self.assertRaises(utils.InvalidatedWeakRef, method)
예제 #3
0
 def test_without_reference_cycle(self):
     obj = ObjectWithDel()
     obj.public = utils.weakmethod(obj.public)
     self.assertEquals(obj.public(), ("public", (), {}))
     del obj
     gc.collect()
     self.assertNotIn(ObjectWithDel, [type(obj) for obj in gc.garbage])
예제 #4
0
파일: utilsTests.py 프로젝트: rexhsu/vdsm
 def test_without_reference_cycle(self):
     obj = ObjectWithDel()
     obj.public = utils.weakmethod(obj.public)
     self.assertEquals(obj.public(), ("public", (), {}))
     del obj
     gc.collect()
     self.assertNotIn(ObjectWithDel, [type(obj) for obj in gc.garbage])