Skip to content

Commit

Permalink
Remove tests not relevant to the backported security fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Sep 2, 2024
1 parent 87ac08d commit d1eca1e
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions Lib/test/test_zipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3296,39 +3296,6 @@ def test_malformed_paths(self):
assert list(map(str, root.iterdir())) == ['../']
assert root.joinpath('..').joinpath('parent.txt').read_bytes() == b'content'

def test_unsupported_names(self):
"""
Path segments with special characters are readable.
On some platforms or file systems, characters like
``:`` and ``?`` are not allowed, but they are valid
in the zip file.
"""
data = io.BytesIO()
zf = zipfile.ZipFile(data, "w")
zf.writestr("path?", b"content")
zf.writestr("V: NMS.flac", b"fLaC...")
zf.filename = ''
root = zipfile.Path(zf)
contents = root.iterdir()
assert next(contents).name == 'path?'
item = next(contents)
assert item.name == 'V: NMS.flac', item.name
assert root.joinpath('V: NMS.flac').read_bytes() == b"fLaC..."

def test_backslash_not_separator(self):
"""
In a zip file, backslashes are not separators.
"""
data = io.BytesIO()
zf = zipfile.ZipFile(data, "w")
zf.writestr(DirtyZipInfo.for_name("foo\\bar", zf), b"content")
zf.filename = ''
root = zipfile.Path(zf)
(first,) = root.iterdir()
assert not first.is_dir()
assert first.name == 'foo\\bar', first.name


class DirtyZipInfo(zipfile.ZipInfo):
"""
Expand Down

0 comments on commit d1eca1e

Please sign in to comment.