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

Method test_container_iterator

Lib/test/test_set.py:355–365  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

353 self.assertEqual(d3, dict.fromkeys(d, 123))
354
355 def test_container_iterator(self):
356 # Bug #3680: tp_traverse was not implemented for set iterator object
357 class C(object):
358 pass
359 obj = C()
360 ref = weakref.ref(obj)
361 container = set([obj, 1])
362 obj.x = iter(container)
363 del obj, container
364 gc.collect()
365 self.assertTrue(ref() is None, "Cycle was not collected")
366
367 def test_free_after_iterating(self):
368 support.check_free_after_iterating(self, iter, self.thetype)

Callers

nothing calls this directly

Calls 4

setFunction · 0.85
assertTrueMethod · 0.80
CClass · 0.70
collectMethod · 0.45

Tested by

no test coverage detected