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

Method test_method_lookup

Lib/test/test_tempfile.py:983–997  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

981 self.do_create(pre="aa", suf=".txt")
982
983 def test_method_lookup(self):
984 # Issue #18879: Looking up a temporary file method should keep it
985 # alive long enough.
986 f = self.do_create()
987 wr = weakref.ref(f)
988 write = f.write
989 write2 = f.write
990 del f
991 write(b'foo')
992 del write
993 write2(b'bar')
994 del write2
995 if support.check_impl_detail(cpython=True):
996 # No reference cycle was created.
997 self.assertIsNone(wr())
998
999 def test_iter(self):
1000 # Issue #23700: getting iterator from a temporary file should keep

Callers

nothing calls this directly

Calls 3

do_createMethod · 0.95
assertIsNoneMethod · 0.80
writeFunction · 0.50

Tested by

no test coverage detected