diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2022-07-24 20:53:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-24 20:53:10 -0400 |
commit | 3e718cf880e8994d76f6296a502497c16a956644 (patch) | |
tree | 4eeeeae42bdb6138b08c5f20711a8b426db606da /Lib/test/test_importlib/resources/test_contents.py | |
parent | 9007dec606b790c05e158e588b696f3c210c2795 (diff) | |
download | cpython-git-3e718cf880e8994d76f6296a502497c16a956644.tar.gz |
gh-95218: Move tests for importlib.resources into test_importlib.resources. (#95219)
* gh-95218: Move tests for importlib.resources into test_importlib.resources.
* Also update makefile
* Include test_importlib/resources in code ownership rule.
Diffstat (limited to 'Lib/test/test_importlib/resources/test_contents.py')
-rw-r--r-- | Lib/test/test_importlib/resources/test_contents.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/resources/test_contents.py b/Lib/test/test_importlib/resources/test_contents.py new file mode 100644 index 0000000000..1a13f043a8 --- /dev/null +++ b/Lib/test/test_importlib/resources/test_contents.py @@ -0,0 +1,43 @@ +import unittest +from importlib import resources + +from . import data01 +from . import util + + +class ContentsTests: + expected = { + '__init__.py', + 'binary.file', + 'subdirectory', + 'utf-16.file', + 'utf-8.file', + } + + def test_contents(self): + contents = {path.name for path in resources.files(self.data).iterdir()} + assert self.expected <= contents + + +class ContentsDiskTests(ContentsTests, unittest.TestCase): + def setUp(self): + self.data = data01 + + +class ContentsZipTests(ContentsTests, util.ZipSetup, unittest.TestCase): + pass + + +class ContentsNamespaceTests(ContentsTests, unittest.TestCase): + expected = { + # no __init__ because of namespace design + # no subdirectory as incidental difference in fixture + 'binary.file', + 'utf-16.file', + 'utf-8.file', + } + + def setUp(self): + from . import namespacedata01 + + self.data = namespacedata01 |