• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import unittest
2from importlib import resources
3
4from . import util
5
6
7class 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
21class ContentsDiskTests(ContentsTests, util.DiskSetup, unittest.TestCase):
22    pass
23
24
25class ContentsZipTests(ContentsTests, util.ZipSetup, unittest.TestCase):
26    pass
27
28
29class 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    }
39