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.
(self)
| 624 | assert root.joinpath('..').joinpath('parent.txt').read_bytes() == b'content' |
| 625 | |
| 626 | def test_unsupported_names(self): |
| 627 | """ |
| 628 | Path segments with special characters are readable. |
| 629 | |
| 630 | On some platforms or file systems, characters like |
| 631 | ``:`` and ``?`` are not allowed, but they are valid |
| 632 | in the zip file. |
| 633 | """ |
| 634 | data = io.BytesIO() |
| 635 | zf = zipfile.ZipFile(data, "w") |
| 636 | zf.writestr("path?", b"content") |
| 637 | zf.writestr("V: NMS.flac", b"fLaC...") |
| 638 | zf.filename = '' |
| 639 | root = zipfile.Path(zf) |
| 640 | contents = root.iterdir() |
| 641 | assert next(contents).name == 'path?' |
| 642 | assert next(contents).name == 'V: NMS.flac' |
| 643 | assert root.joinpath('V: NMS.flac').read_bytes() == b"fLaC..." |
| 644 | |
| 645 | def test_backslash_not_separator(self): |
| 646 | """ |
nothing calls this directly
no test coverage detected