2021-07-29 22:05:05 -03:00
|
|
|
import unittest
|
|
|
|
from importlib import resources
|
|
|
|
|
2022-01-22 22:38:26 -04:00
|
|
|
from . import data01
|
|
|
|
from .resources import util
|
2021-07-29 22:05:05 -03:00
|
|
|
|
|
|
|
|
|
|
|
class ContentsTests:
|
|
|
|
expected = {
|
|
|
|
'__init__.py',
|
|
|
|
'binary.file',
|
|
|
|
'subdirectory',
|
|
|
|
'utf-16.file',
|
|
|
|
'utf-8.file',
|
|
|
|
}
|
|
|
|
|
|
|
|
def test_contents(self):
|
2021-12-18 22:28:49 -04:00
|
|
|
contents = {path.name for path in resources.files(self.data).iterdir()}
|
|
|
|
assert self.expected <= contents
|
2021-07-29 22:05:05 -03:00
|
|
|
|
|
|
|
|
|
|
|
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):
|
2022-01-22 22:38:26 -04:00
|
|
|
from . import namespacedata01
|
2021-07-29 22:05:05 -03:00
|
|
|
|
|
|
|
self.data = namespacedata01
|