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

Method test_fileobj_readlines

Lib/test/test_tarfile.py:137–153  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

135 "regular file extraction failed")
136
137 def test_fileobj_readlines(self):
138 self.tar.extract("ustar/regtype", TEMPDIR, filter='data')
139 tarinfo = self.tar.getmember("ustar/regtype")
140 with open(os.path.join(TEMPDIR, "ustar/regtype"), "r") as fobj1:
141 lines1 = fobj1.readlines()
142
143 with self.tar.extractfile(tarinfo) as fobj:
144 fobj2 = io.TextIOWrapper(fobj)
145 lines2 = fobj2.readlines()
146 self.assertEqual(lines1, lines2,
147 "fileobj.readlines() failed")
148 self.assertEqual(len(lines2), 114,
149 "fileobj.readlines() failed")
150 self.assertEqual(lines2[83],
151 "I will gladly admit that Python is not the fastest "
152 "running scripting language.\n",
153 "fileobj.readlines() failed")
154
155 def test_fileobj_iter(self):
156 self.tar.extract("ustar/regtype", TEMPDIR, filter='data')

Callers

nothing calls this directly

Calls 7

getmemberMethod · 0.80
extractfileMethod · 0.80
openFunction · 0.50
extractMethod · 0.45
joinMethod · 0.45
readlinesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected