@@ -846,11 +846,14 @@ def test_get_stats(self):
846846 self .assertEqual (len (stats ), 3 )
847847 for st in stats :
848848 self .assertIsInstance (st , dict )
849- self .assertEqual (set (st ),
850- {"collected" , "collections" , "uncollectable" , "duration" })
849+ self .assertEqual (
850+ set (st ),
851+ {"collected" , "collections" , "uncollectable" , "visited" , "duration" }
852+ )
851853 self .assertGreaterEqual (st ["collected" ], 0 )
852854 self .assertGreaterEqual (st ["collections" ], 0 )
853855 self .assertGreaterEqual (st ["uncollectable" ], 0 )
856+ self .assertGreaterEqual (st ["visited" ], 0 )
854857 self .assertGreaterEqual (st ["duration" ], 0 )
855858 # Check that collection counts are incremented correctly
856859 if gc .isenabled ():
@@ -865,7 +868,7 @@ def test_get_stats(self):
865868 self .assertGreater (new [0 ]["duration" ], old [0 ]["duration" ])
866869 self .assertEqual (new [1 ]["duration" ], old [1 ]["duration" ])
867870 self .assertEqual (new [2 ]["duration" ], old [2 ]["duration" ])
868- for stat in ["collected" , "uncollectable" ]:
871+ for stat in ["collected" , "uncollectable" , "visited" ]:
869872 self .assertGreaterEqual (new [0 ][stat ], old [0 ][stat ])
870873 self .assertEqual (new [1 ][stat ], old [1 ][stat ])
871874 self .assertEqual (new [2 ][stat ], old [2 ][stat ])
@@ -877,7 +880,7 @@ def test_get_stats(self):
877880 self .assertEqual (new [0 ]["duration" ], old [0 ]["duration" ])
878881 self .assertEqual (new [1 ]["duration" ], old [1 ]["duration" ])
879882 self .assertGreater (new [2 ]["duration" ], old [2 ]["duration" ])
880- for stat in ["collected" , "uncollectable" ]:
883+ for stat in ["collected" , "uncollectable" , "visited" ]:
881884 self .assertEqual (new [0 ][stat ], old [0 ][stat ])
882885 self .assertEqual (new [1 ][stat ], old [1 ][stat ])
883886 self .assertGreaterEqual (new [2 ][stat ], old [2 ][stat ])
@@ -1316,6 +1319,7 @@ def test_collect(self):
13161319 self .assertIn ("generation" , info )
13171320 self .assertIn ("collected" , info )
13181321 self .assertIn ("uncollectable" , info )
1322+ self .assertIn ("visited" , info )
13191323 self .assertIn ("duration" , info )
13201324
13211325 def test_collect_generation (self ):
0 commit comments