(self)
| 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 |
| 1239 | # Issue #141707 |
| 1240 | buf = io.BytesIO() |
| 1241 | with tarfile.open(mode='w', fileobj=buf, format=self.format) as tar: |
| 1242 | ti = tarfile.TarInfo() |
| 1243 | ti.type = tarfile.AREGTYPE |
| 1244 | ti.name = ('a' * 99) + '/' + ('b' * 3) |
| 1245 | tar.addfile(ti) |
| 1246 | |
| 1247 | expected = {t.name: t.type for t in tar.getmembers()} |
| 1248 | |
| 1249 | buf.seek(0) |
| 1250 | with tarfile.open(mode='r', fileobj=buf) as tar: |
| 1251 | actual = {t.name: t.type for t in tar.getmembers()} |
| 1252 | |
| 1253 | self.assertEqual(expected, actual) |
| 1254 | |
| 1255 | |
| 1256 | class GNUReadTest(LongnameTest, ReadTest, unittest.TestCase): |
nothing calls this directly
no test coverage detected