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

Method test_longname_directory

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

Source from the content-addressed store, hash-verified

1220 self.assertEqual(tarinfo.type, self.longnametype)
1221
1222 def test_longname_directory(self):
1223 # Test reading a longlink directory. Issue #47231.
1224 longdir = ('a' * 101) + '/'
1225 with os_helper.temp_cwd():
1226 with tarfile.open(tmpname, 'w') as tar:
1227 tar.format = self.format
1228 try:
1229 os.mkdir(longdir)
1230 tar.add(longdir)
1231 finally:
1232 os.rmdir(longdir.rstrip("/"))
1233 with tarfile.open(tmpname) as tar:
1234 self.assertIsNotNone(tar.getmember(longdir))
1235 self.assertIsNotNone(tar.getmember(longdir.removesuffix('/')))
1236
1237 def test_longname_file_not_directory(self):
1238 # Test reading a longname file and ensure it is not handled as a directory

Callers

nothing calls this directly

Calls 8

rmdirMethod · 0.80
assertIsNotNoneMethod · 0.80
getmemberMethod · 0.80
openMethod · 0.45
mkdirMethod · 0.45
addMethod · 0.45
rstripMethod · 0.45
removesuffixMethod · 0.45

Tested by

no test coverage detected