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

Method multi_line_test

Lib/test/test_io/test_textio.py:557–577  ·  view source on GitHub ↗
(self, f, enc)

Source from the content-addressed store, hash-verified

555 f.close()
556
557 def multi_line_test(self, f, enc):
558 f.seek(0)
559 f.truncate()
560 sample = "s\xff\u0fff\uffff"
561 wlines = []
562 for size in (0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 62, 63, 64, 65, 1000):
563 chars = []
564 for i in range(size):
565 chars.append(sample[i % len(sample)])
566 line = "".join(chars) + "\n"
567 wlines.append((f.tell(), line))
568 f.write(line)
569 f.seek(0)
570 rlines = []
571 while True:
572 pos = f.tell()
573 line = f.readline()
574 if not line:
575 break
576 rlines.append((pos, line))
577 self.assertEqual(rlines, wlines)
578
579 def test_telling(self):
580 f = self.open(os_helper.TESTFN, "w+", encoding="utf-8")

Callers 1

test_basic_ioMethod · 0.95

Calls 8

seekMethod · 0.45
truncateMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45
tellMethod · 0.45
writeMethod · 0.45
readlineMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected