self.assertIsInstance(i1, ecore.Idler) self.assertIsInstance(i2, ecore.Idler) before1 = i1.__repr__() before2 = i2.__repr__() t = ecore.timer_add(1, ecore.main_loop_quit) ecore.main_loop_begin() after1 = i1.__repr__() after2 = i2.__repr__() self.assertEqual(before1, after1) self.assertNotEqual(before2, after2) # already deleted self.assertEqual(t.is_deleted(), True) self.assertEqual(i1.is_deleted(), False) self.assertEqual(i2.is_deleted(), True) i1.delete() del t del i1 del i2 # already deleted since returned false if __name__ == '__main__': unittest.main(verbosity=2) ecore.shutdown()
t = ecore.Timer(1, ecore.main_loop_quit) timer = ecore.Timer(0.1, sleeper) idler = ecore.Idler(cb_idle) ecore.main_loop_begin() timer.delete() idler.delete() after1 = i1.__repr__() after2 = i2.__repr__() self.assertEqual(before1, after1) self.assertNotEqual(before2, after2) # already deleted self.assertEqual(t.is_deleted(), True) self.assertEqual(i1.is_deleted(), False) self.assertEqual(i2.is_deleted(), True) i1.delete() del i1 del i2 # already deleted since returned false del t del timer del idler if __name__ == '__main__': unittest.main(verbosity=2) ecore.shutdown()