Debian Codegraph @

lib-python/3/test/test_importlib/test_contents.py

raw symbols SCIP
1 import unittest
2 from importlib import resources
3
4 from . import data01
5 from .resources import util
6
7
8 class ContentsTests:
9 expected = {
10 '__init__.py',
11 'binary.file',
12 'subdirectory',
13 'utf-16.file',
14 'utf-8.file',
15 }
16
17 def test_contents(self):
18 contents = {path.name for path in resources.files(self.data).iterdir()}
19 assert self.expected <= contents
20
21
22 class ContentsDiskTests(ContentsTests, unittest.TestCase):
23 def setUp(self):
24 self.data = data01
25
26
27 class ContentsZipTests(ContentsTests, util.ZipSetup, unittest.TestCase):
28 pass
29
30
31 class ContentsNamespaceTests(ContentsTests, unittest.TestCase):
32 expected = {
33 # no __init__ because of namespace design
34 # no subdirectory as incidental difference in fixture
35 'binary.file',
36 'utf-16.file',
37 'utf-8.file',
38 }
39
40 def setUp(self):
41 from . import namespacedata01
42
43 self.data = namespacedata01