(self)
| 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 |
nothing calls this directly
no test coverage detected