MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_function

Method test_function

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

Source from the content-addressed store, hash-verified

226 gc.garbage.remove(obj)
227
228 def test_function(self):
229 # Tricky: f -> d -> f, code should call d.clear() after the exec to
230 # break the cycle.
231 d = {}
232 exec("def f(): pass\n", d)
233 gc.collect()
234 del d
235 # In the free-threaded build, the count returned by `gc.collect()`
236 # is 3 because it includes f's code object.
237 self.assertIn(gc.collect(), (2, 3))
238
239 # TODO: RUSTPYTHON - weakref clear ordering differs from 3.15+
240 @unittest.expectedFailure

Callers

nothing calls this directly

Calls 3

collectMethod · 0.80
assertInMethod · 0.80
execFunction · 0.50

Tested by

no test coverage detected