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

Method test_gc_debug_stats

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

Source from the content-addressed store, hash-verified

803
804 @unittest.skipIf(Py_GIL_DISABLED, "requires GC generations or increments")
805 def test_gc_debug_stats(self):
806 # Checks that debug information is printed to stderr
807 # when DEBUG_STATS is set.
808 code = """if 1:
809 import gc
810 gc.set_debug(%s)
811 gc.collect()
812 """
813 _, _, err = assert_python_ok("-c", code % "gc.DEBUG_STATS")
814 self.assertRegex(err, b"gc: collecting generation [0-9]+")
815 self.assertRegex(
816 err,
817 b"gc: objects in each generation: [0-9]+ [0-9]+ [0-9]+",
818 )
819 self.assertRegex(
820 err, b"gc: objects in permanent generation: [0-9]+"
821 )
822 self.assertRegex(
823 err,
824 b"gc: done, .* unreachable, .* uncollectable, .* elapsed",
825 )
826
827 _, _, err = assert_python_ok("-c", code % "0")
828 self.assertNotIn(b"elapsed", err)
829
830 def test_global_del_SystemExit(self):
831 code = """if 1:

Callers

nothing calls this directly

Calls 3

assert_python_okFunction · 0.90
assertRegexMethod · 0.80
assertNotInMethod · 0.80

Tested by

no test coverage detected