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

Method test_newinstance

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

Source from the content-addressed store, hash-verified

140 self.assertNotEqual(gc.collect(), 0)
141
142 def test_newinstance(self):
143 class A(object):
144 pass
145 a = A()
146 a.a = a
147 gc.collect()
148 del a
149 self.assertNotEqual(gc.collect(), 0)
150 class B(list):
151 pass
152 class C(B, A):
153 pass
154 a = C()
155 a.a = a
156 gc.collect()
157 del a
158 self.assertNotEqual(gc.collect(), 0)
159 del B, C
160 self.assertNotEqual(gc.collect(), 0)
161 A.a = A()
162 del A
163 self.assertNotEqual(gc.collect(), 0)
164 self.assertEqual(gc.collect(), 0)
165
166 def test_method(self):
167 # Tricky: self.__init__ is a bound method, it references the instance.

Callers

nothing calls this directly

Calls 5

assertNotEqualMethod · 0.80
AClass · 0.70
CClass · 0.70
collectMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected