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

Method test_references

Lib/test/test_queue.py:999–1012  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

997 self.assertEqual(sorted(results), inputs)
998
999 def test_references(self):
1000 # The queue should lose references to each item as soon as
1001 # it leaves the queue.
1002 class C:
1003 pass
1004
1005 N = 20
1006 q = self.q
1007 for i in range(N):
1008 q.put(C())
1009 for i in range(N):
1010 wr = weakref.ref(q.get())
1011 gc_collect() # For PyPy or other GCs.
1012 self.assertIsNone(wr())
1013
1014
1015class PySimpleQueueTest(BaseSimpleQueueTest, unittest.TestCase):

Callers

nothing calls this directly

Calls 5

gc_collectFunction · 0.90
assertIsNoneMethod · 0.80
CClass · 0.70
putMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected