mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-32964: Reuse a testing implementation of the path protocol in tests. (#5930)
This commit is contained in:
parent
bf63e8d55f
commit
b21d155f57
11 changed files with 70 additions and 103 deletions
|
@ -22,7 +22,7 @@ import tarfile
|
|||
import zipfile
|
||||
|
||||
from test import support
|
||||
from test.support import TESTFN
|
||||
from test.support import TESTFN, FakePath
|
||||
|
||||
TESTFN2 = TESTFN + "2"
|
||||
|
||||
|
@ -1232,14 +1232,7 @@ class TestShutil(unittest.TestCase):
|
|||
def check_unpack_archive(self, format):
|
||||
self.check_unpack_archive_with_converter(format, lambda path: path)
|
||||
self.check_unpack_archive_with_converter(format, pathlib.Path)
|
||||
|
||||
class MyPath:
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
def __fspath__(self):
|
||||
return self.path
|
||||
|
||||
self.check_unpack_archive_with_converter(format, MyPath)
|
||||
self.check_unpack_archive_with_converter(format, FakePath)
|
||||
|
||||
def check_unpack_archive_with_converter(self, format, converter):
|
||||
root_dir, base_dir = self._create_files()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue