summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-10-16 19:00:39 (GMT)
committerGitHub <noreply@github.com>2022-10-16 19:00:39 (GMT)
commitcea910ebf14d1bd9d8bc0c8a5046e69ae8f5be17 (patch)
treed8f509aa9e5bbb452117ce6eb5de2714171edeb4 /Lib/test/test_importlib
parent5c9302d03a57759225dab9e2d7bdd38e79009441 (diff)
downloadcpython-cea910ebf14d1bd9d8bc0c8a5046e69ae8f5be17.zip
cpython-cea910ebf14d1bd9d8bc0c8a5046e69ae8f5be17.tar.gz
cpython-cea910ebf14d1bd9d8bc0c8a5046e69ae8f5be17.tar.bz2
gh-97930: Merge with importlib_resources 5.9 (GH-97929)
* Merge with importlib_resources 5.9 * Update changelog
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/resources/test_reader.py5
-rw-r--r--Lib/test/test_importlib/resources/test_resource.py8
2 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/resources/test_reader.py b/Lib/test/test_importlib/resources/test_reader.py
index 9d20c97..4fd9e6b 100644
--- a/Lib/test/test_importlib/resources/test_reader.py
+++ b/Lib/test/test_importlib/resources/test_reader.py
@@ -75,6 +75,11 @@ class MultiplexedPathTest(unittest.TestCase):
str(path.joinpath('imaginary'))[len(prefix) + 1 :],
os.path.join('namespacedata01', 'imaginary'),
)
+ self.assertEqual(path.joinpath(), path)
+
+ def test_join_path_compound(self):
+ path = MultiplexedPath(self.folder)
+ assert not path.joinpath('imaginary/foo.py').exists()
def test_repr(self):
self.assertEqual(
diff --git a/Lib/test/test_importlib/resources/test_resource.py b/Lib/test/test_importlib/resources/test_resource.py
index 1d6df0c..f7e3abb 100644
--- a/Lib/test/test_importlib/resources/test_resource.py
+++ b/Lib/test/test_importlib/resources/test_resource.py
@@ -111,6 +111,14 @@ class ResourceFromZipsTest01(util.ZipSetupBase, unittest.TestCase):
{'__init__.py', 'binary.file'},
)
+ def test_as_file_directory(self):
+ with resources.as_file(resources.files('ziptestdata')) as data:
+ assert data.name == 'ziptestdata'
+ assert data.is_dir()
+ assert data.joinpath('subdirectory').is_dir()
+ assert len(list(data.iterdir()))
+ assert not data.parent.exists()
+
class ResourceFromZipsTest02(util.ZipSetupBase, unittest.TestCase):
ZIP_MODULE = zipdata02 # type: ignore