コード例 #1
0
ファイル: utilsTests.py プロジェクト: yingyun001/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)
コード例 #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
ファイル: utilsTests.py プロジェクト: yingyun001/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])
コード例 #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])