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

Method test_readline_binary_mode

Lib/test/test_fileinput.py:305–316  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

303 self.assertEqual(fi.readline(), '')
304
305 def test_readline_binary_mode(self):
306 with open(TESTFN, 'wb') as f:
307 f.write(b'A\nB\r\nC\rD')
308 self.addCleanup(safe_unlink, TESTFN)
309
310 with FileInput(files=TESTFN, mode='rb') as fi:
311 self.assertEqual(fi.readline(), b'A\n')
312 self.assertEqual(fi.readline(), b'B\r\n')
313 self.assertEqual(fi.readline(), b'C\rD')
314 # Read to the end of file.
315 self.assertEqual(fi.readline(), b'')
316 self.assertEqual(fi.readline(), b'')
317
318 def test_inplace_binary_write_mode(self):
319 temp_file = self.writeTmp(b'Initial text.', mode='wb')

Callers

nothing calls this directly

Calls 6

FileInputClass · 0.90
addCleanupMethod · 0.80
openFunction · 0.50
writeMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45

Tested by

no test coverage detected