summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorBrett Cannon <brettcannon@users.noreply.github.com>2017-12-16 00:29:35 (GMT)
committerGitHub <noreply@github.com>2017-12-16 00:29:35 (GMT)
commit4ac5150e068a3a795ef00465f6dff51747b62b91 (patch)
treeb9e051b66549fae628764ca110a61fc1c153a827 /Lib/test/test_importlib
parentd2b02310acbfe6c978a8ad3cd3ac8b3f12927442 (diff)
downloadcpython-4ac5150e068a3a795ef00465f6dff51747b62b91.zip
cpython-4ac5150e068a3a795ef00465f6dff51747b62b91.tar.gz
cpython-4ac5150e068a3a795ef00465f6dff51747b62b91.tar.bz2
bpo-32248: Implement importlib.abc.ResourceReader (GH-4892)
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/test_abc.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py
index 4ba28c6..f1e1db3 100644
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -305,6 +305,45 @@ class ExecutionLoaderDefaultsTests(ABCTestHarness):
) = test_util.test_both(InspectLoaderDefaultsTests)
+class ResourceReader:
+
+ def open_resource(self, *args, **kwargs):
+ return super().open_resource(*args, **kwargs)
+
+ def resource_path(self, *args, **kwargs):
+ return super().resource_path(*args, **kwargs)
+
+ def is_resource(self, *args, **kwargs):
+ return super().is_resource(*args, **kwargs)
+
+ def contents(self, *args, **kwargs):
+ return super().contents(*args, **kwargs)
+
+
+class ResourceReaderDefaultsTests(ABCTestHarness):
+
+ SPLIT = make_abc_subclasses(ResourceReader)
+
+ def test_open_resource(self):
+ with self.assertRaises(FileNotFoundError):
+ self.ins.open_resource('dummy_file')
+
+ def test_resource_path(self):
+ with self.assertRaises(FileNotFoundError):
+ self.ins.resource_path('dummy_file')
+
+ def test_is_resource(self):
+ with self.assertRaises(FileNotFoundError):
+ self.ins.is_resource('dummy_file')
+
+ def test_contents(self):
+ self.assertEqual([], list(self.ins.contents()))
+
+(Frozen_RRDefaultTests,
+ Source_RRDefaultsTests
+ ) = test_util.test_both(ResourceReaderDefaultsTests)
+
+
##### MetaPathFinder concrete methods ##########################################
class MetaPathFinderFindModuleTests: