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

Method test_destructor

Lib/test/test_io/test_textio.py:479–491  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

477 self.assertEqual(buf.getvalue(), expected)
478
479 def test_destructor(self):
480 l = []
481 base = self.BytesIO
482 class MyBytesIO(base):
483 def close(self):
484 l.append(self.getvalue())
485 base.close(self)
486 b = MyBytesIO()
487 t = self.TextIOWrapper(b, encoding="ascii")
488 t.write("abc")
489 del t
490 support.gc_collect()
491 self.assertEqual([b"abc"], l)
492
493 def test_override_destructor(self):
494 record = []

Callers

nothing calls this directly

Calls 3

writeMethod · 0.95
MyBytesIOClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected