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

Method test_readinto

Lib/test/test_io/test_bufferedio.py:1074–1085  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1072 self.assertEqual(pair.read1(), b"def")
1073
1074 def test_readinto(self):
1075 for method in ("readinto", "readinto1"):
1076 with self.subTest(method):
1077 pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO())
1078
1079 data = byteslike(b'\0' * 5)
1080 self.assertEqual(getattr(pair, method)(data), 5)
1081 self.assertEqual(bytes(data), b"abcde")
1082
1083 # gh-138720: C BufferedRWPair would destruct in a bad order resulting in
1084 # an unraisable exception.
1085 support.gc_collect()
1086
1087 def test_write(self):
1088 w = self.MockRawIO()

Callers

nothing calls this directly

Calls 3

byteslikeFunction · 0.85
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected