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

Method testWeakRefs

Lib/test/test_io/test_fileio.py:41–49  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

39 os.remove(TESTFN)
40
41 def testWeakRefs(self):
42 # verify weak references
43 p = proxy(self.f)
44 p.write(bytes(range(10)))
45 self.assertEqual(self.f.tell(), p.tell())
46 self.f.close()
47 self.f = None
48 gc_collect() # For PyPy or other GCs.
49 self.assertRaises(ReferenceError, getattr, p, 'tell')
50
51 def testSeekTell(self):
52 self.f.write(bytes(range(20)))

Callers

nothing calls this directly

Calls 6

gc_collectFunction · 0.90
writeMethod · 0.45
assertEqualMethod · 0.45
tellMethod · 0.45
closeMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected