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

Method testReadlinesNoNewline

Lib/test/test_bz2.py:466–476  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

464 self.assertRaises(OSError, BZ2File, "/non/existent")
465
466 def testReadlinesNoNewline(self):
467 # Issue #1191043: readlines() fails on a file containing no newline.
468 data = b'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x00!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t'
469 with open(self.filename, "wb") as f:
470 f.write(data)
471 with BZ2File(self.filename) as bz2f:
472 lines = bz2f.readlines()
473 self.assertEqual(lines, [b'Test'])
474 with BZ2File(self.filename) as bz2f:
475 xlines = list(bz2f.readlines())
476 self.assertEqual(xlines, [b'Test'])
477
478 def testContextProtocol(self):
479 with BZ2File(self.filename, "wb") as f:

Callers

nothing calls this directly

Calls 6

BZ2FileClass · 0.90
listClass · 0.85
openFunction · 0.50
writeMethod · 0.45
readlinesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected