diff options
Diffstat (limited to 'Lib/test/test_importlib/test_contents.py')
-rw-r--r-- | Lib/test/test_importlib/test_contents.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_contents.py b/Lib/test/test_importlib/test_contents.py new file mode 100644 index 0000000000..0f3aa84f5b --- /dev/null +++ b/Lib/test/test_importlib/test_contents.py @@ -0,0 +1,42 @@ +import unittest +from importlib import resources + +from . import data01 +from .resources import util + + +class ContentsTests: + expected = { + '__init__.py', + 'binary.file', + 'subdirectory', + 'utf-16.file', + 'utf-8.file', + } + + def test_contents(self): + assert self.expected <= set(resources.contents(self.data)) + + +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 |