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

Method test_container_iterator

Lib/test/test_dict.py:953–967  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

951 d = {}
952
953 def test_container_iterator(self):
954 # Bug #3680: tp_traverse was not implemented for dictiter and
955 # dictview objects.
956 class C(object):
957 pass
958 views = (dict.items, dict.values, dict.keys)
959 for v in views:
960 obj = C()
961 ref = weakref.ref(obj)
962 container = {obj: 1}
963 obj.v = v(container)
964 obj.x = iter(obj.v)
965 del obj, container
966 gc.collect()
967 self.assertIs(ref(), None, "Cycle was not collected")
968
969 def make_shared_key_dict(self, n):
970 class C:

Callers

nothing calls this directly

Calls 4

CClass · 0.70
vFunction · 0.50
collectMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected