1import unittest
2from importlib import resources
3
4from . import data01
5from .resources import util
6
7
8class 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
22class ContentsDiskTests(ContentsTests, unittest.TestCase):
23    def setUp(self):
24        self.data = data01
25
26
27class ContentsZipTests(ContentsTests, util.ZipSetup, unittest.TestCase):
28    pass
29
30
31class 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
44