|
| 1 | +import contextlib |
1 | 2 | import io |
2 | 3 | import itertools |
3 | | -import contextlib |
4 | 4 | import pathlib |
5 | 5 | import pickle |
6 | 6 | import stat |
|
9 | 9 | import zipfile |
10 | 10 | import zipfile._path |
11 | 11 |
|
12 | | -from test.support.os_helper import temp_dir, FakePath |
| 12 | +from test.support.os_helper import FakePath, temp_dir |
13 | 13 |
|
14 | 14 | from ._functools import compose |
15 | 15 | from ._itertools import Counter |
16 | | - |
17 | | -from ._test_params import parameterize, Invoked |
| 16 | +from ._test_params import Invoked, parameterize |
18 | 17 |
|
19 | 18 |
|
20 | 19 | class jaraco: |
@@ -193,10 +192,10 @@ def test_encoding_warnings(self, alpharep): |
193 | 192 | """EncodingWarning must blame the read_text and open calls.""" |
194 | 193 | assert sys.flags.warn_default_encoding |
195 | 194 | root = zipfile.Path(alpharep) |
196 | | - with self.assertWarns(EncodingWarning) as wc: |
| 195 | + with self.assertWarns(EncodingWarning) as wc: # noqa: F821 (astral-sh/ruff#13296) |
197 | 196 | root.joinpath("a.txt").read_text() |
198 | 197 | assert __file__ == wc.filename |
199 | | - with self.assertWarns(EncodingWarning) as wc: |
| 198 | + with self.assertWarns(EncodingWarning) as wc: # noqa: F821 (astral-sh/ruff#13296) |
200 | 199 | root.joinpath("a.txt").open("r").close() |
201 | 200 | assert __file__ == wc.filename |
202 | 201 |
|
@@ -364,6 +363,17 @@ def test_root_name(self, alpharep): |
364 | 363 | root = zipfile.Path(alpharep) |
365 | 364 | assert root.name == 'alpharep.zip' == root.filename.name |
366 | 365 |
|
| 366 | + @pass_alpharep |
| 367 | + def test_root_on_disk(self, alpharep): |
| 368 | + """ |
| 369 | + The name/stem of the root should match the zipfile on disk. |
| 370 | +
|
| 371 | + This condition must hold across platforms. |
| 372 | + """ |
| 373 | + root = zipfile.Path(self.zipfile_ondisk(alpharep)) |
| 374 | + assert root.name == 'alpharep.zip' == root.filename.name |
| 375 | + assert root.stem == 'alpharep' == root.filename.stem |
| 376 | + |
367 | 377 | @pass_alpharep |
368 | 378 | def test_suffix(self, alpharep): |
369 | 379 | """ |
|
0 commit comments