Debian Codegraph @

Lib/test/test_importlib/resources/test_contents.py

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