MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_readline

Method test_readline

Lib/test/test_io.py:613–625  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

611 self.read_ops(f, True)
612
613 def test_readline(self):
614 with self.open(os_helper.TESTFN, "wb") as f:
615 f.write(b"abc\ndef\nxyzzy\nfoo\x00bar\nanother line")
616 with self.open(os_helper.TESTFN, "rb") as f:
617 self.assertEqual(f.readline(), b"abc\n")
618 self.assertEqual(f.readline(10), b"def\n")
619 self.assertEqual(f.readline(2), b"xy")
620 self.assertEqual(f.readline(4), b"zzy\n")
621 self.assertEqual(f.readline(), b"foo\x00bar\n")
622 self.assertEqual(f.readline(None), b"another line")
623 self.assertRaises(TypeError, f.readline, 5.3)
624 with self.open(os_helper.TESTFN, "r", encoding="utf-8") as f:
625 self.assertRaises(TypeError, f.readline, 5.3)
626
627 def test_readline_nonsizeable(self):
628 # Issue #30061

Callers

nothing calls this directly

Calls 5

openMethod · 0.45
writeMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected