MCPcopy Index your code
hub / github.com/python/cpython / test_is_finalized

Method test_is_finalized

Lib/test/test_gc.py:643–659  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

641 self.assertTrue(gc.is_tracked(UserIntSlots()))
642
643 def test_is_finalized(self):
644 # Objects not tracked by the always gc return false
645 self.assertFalse(gc.is_finalized(3))
646
647 storage = []
648 class Lazarus:
649 def __del__(self):
650 storage.append(self)
651
652 lazarus = Lazarus()
653 self.assertFalse(gc.is_finalized(lazarus))
654
655 del lazarus
656 gc.collect()
657
658 lazarus = storage.pop()
659 self.assertTrue(gc.is_finalized(lazarus))
660
661 def test_bug1055820b(self):
662 # Corresponds to temp2b.py in the bug report.

Callers

nothing calls this directly

Calls 5

LazarusClass · 0.85
assertFalseMethod · 0.80
assertTrueMethod · 0.80
collectMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected