@@ -18,7 +18,7 @@ def execute(self, package, path):
18
18
class ReadTests :
19
19
def test_read_bytes (self ):
20
20
result = resources .files (self .data ).joinpath ('binary.file' ).read_bytes ()
21
- self .assertEqual (result , b' \0 \1 \2 \3 ' )
21
+ self .assertEqual (result , bytes ( range ( 4 )) )
22
22
23
23
def test_read_text_default_encoding (self ):
24
24
result = (
@@ -57,17 +57,15 @@ class ReadDiskTests(ReadTests, unittest.TestCase):
57
57
58
58
class ReadZipTests (ReadTests , util .ZipSetup , unittest .TestCase ):
59
59
def test_read_submodule_resource (self ):
60
- submodule = import_module ('ziptestdata .subdirectory' )
60
+ submodule = import_module ('data01 .subdirectory' )
61
61
result = resources .files (submodule ).joinpath ('binary.file' ).read_bytes ()
62
- self .assertEqual (result , b' \0 \1 \2 \3 ' )
62
+ self .assertEqual (result , bytes ( range ( 4 , 8 )) )
63
63
64
64
def test_read_submodule_resource_by_name (self ):
65
65
result = (
66
- resources .files ('ziptestdata.subdirectory' )
67
- .joinpath ('binary.file' )
68
- .read_bytes ()
66
+ resources .files ('data01.subdirectory' ).joinpath ('binary.file' ).read_bytes ()
69
67
)
70
- self .assertEqual (result , b' \0 \1 \2 \3 ' )
68
+ self .assertEqual (result , bytes ( range ( 4 , 8 )) )
71
69
72
70
73
71
class ReadNamespaceTests (ReadTests , unittest .TestCase ):
@@ -77,5 +75,22 @@ def setUp(self):
77
75
self .data = namespacedata01
78
76
79
77
78
+ class ReadNamespaceZipTests (ReadTests , util .ZipSetup , unittest .TestCase ):
79
+ ZIP_MODULE = 'namespacedata01'
80
+
81
+ def test_read_submodule_resource (self ):
82
+ submodule = import_module ('namespacedata01.subdirectory' )
83
+ result = resources .files (submodule ).joinpath ('binary.file' ).read_bytes ()
84
+ self .assertEqual (result , bytes (range (12 , 16 )))
85
+
86
+ def test_read_submodule_resource_by_name (self ):
87
+ result = (
88
+ resources .files ('namespacedata01.subdirectory' )
89
+ .joinpath ('binary.file' )
90
+ .read_bytes ()
91
+ )
92
+ self .assertEqual (result , bytes (range (12 , 16 )))
93
+
94
+
80
95
if __name__ == '__main__' :
81
96
unittest .main ()
0 commit comments