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

Method test_header_offset

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

Source from the content-addressed store, hash-verified

1209 tarfile.open(name="foo.tar", fileobj=fobj)
1210
1211 def test_header_offset(self):
1212 # Test if the start offset of the TarInfo object includes
1213 # the preceding extended header.
1214 longname = self.subdir + "/" + "123/" * 125 + "longname"
1215 offset = self.tar.getmember(longname).offset
1216 with open(tarname, "rb") as fobj:
1217 fobj.seek(offset)
1218 tarinfo = tarfile.TarInfo.frombuf(fobj.read(512),
1219 "iso8859-1", "strict")
1220 self.assertEqual(tarinfo.type, self.longnametype)
1221
1222 def test_longname_directory(self):
1223 # Test reading a longlink directory. Issue #47231.

Callers

nothing calls this directly

Calls 6

getmemberMethod · 0.80
frombufMethod · 0.80
openFunction · 0.50
seekMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected