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

Method testReadintoByteArray

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

Source from the content-addressed store, hash-verified

86
87 # verify readinto
88 def testReadintoByteArray(self):
89 self.f.write(bytes([1, 2, 0, 255]))
90 self.f.close()
91
92 ba = bytearray(b'abcdefgh')
93 with self.FileIO(TESTFN, 'r') as f:
94 n = f.readinto(ba)
95 self.assertEqual(ba, b'\x01\x02\x00\xffefgh')
96 self.assertEqual(n, 4)
97
98 def _testReadintoMemoryview(self):
99 self.f.write(bytes([1, 2, 0, 255]))

Callers

nothing calls this directly

Calls 4

writeMethod · 0.45
closeMethod · 0.45
readintoMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected