@@ -101,7 +101,7 @@ def zipfile_ondisk(self, alpharep):
101
101
def test_iterdir_and_types (self , alpharep ):
102
102
root = zipfile .Path (alpharep )
103
103
assert root .is_dir ()
104
- a , k , b , g , j = root .iterdir ()
104
+ a , n , b , g , j = root .iterdir ()
105
105
assert a .is_file ()
106
106
assert b .is_dir ()
107
107
assert g .is_dir ()
@@ -121,7 +121,7 @@ def test_is_file_missing(self, alpharep):
121
121
@pass_alpharep
122
122
def test_iterdir_on_file (self , alpharep ):
123
123
root = zipfile .Path (alpharep )
124
- a , k , b , g , j = root .iterdir ()
124
+ a , n , b , g , j = root .iterdir ()
125
125
with self .assertRaises (ValueError ):
126
126
a .iterdir ()
127
127
@@ -136,7 +136,7 @@ def test_subdir_is_dir(self, alpharep):
136
136
@pass_alpharep
137
137
def test_open (self , alpharep ):
138
138
root = zipfile .Path (alpharep )
139
- a , k , b , g , j = root .iterdir ()
139
+ a , n , b , g , j = root .iterdir ()
140
140
with a .open (encoding = "utf-8" ) as strm :
141
141
data = strm .read ()
142
142
self .assertEqual (data , "content of a" )
@@ -240,7 +240,7 @@ def test_open_missing_directory(self, alpharep):
240
240
@pass_alpharep
241
241
def test_read (self , alpharep ):
242
242
root = zipfile .Path (alpharep )
243
- a , k , b , g , j = root .iterdir ()
243
+ a , n , b , g , j = root .iterdir ()
244
244
assert a .read_text (encoding = "utf-8" ) == "content of a"
245
245
# Also check positional encoding arg (gh-101144).
246
246
assert a .read_text ("utf-8" ) == "content of a"
@@ -306,7 +306,7 @@ def test_mutability(self, alpharep):
306
306
reflect that change.
307
307
"""
308
308
root = zipfile .Path (alpharep )
309
- a , k , b , g , j = root .iterdir ()
309
+ a , n , b , g , j = root .iterdir ()
310
310
alpharep .writestr ('foo.txt' , 'foo' )
311
311
alpharep .writestr ('bar/baz.txt' , 'baz' )
312
312
assert any (child .name == 'foo.txt' for child in root .iterdir ())
@@ -475,6 +475,18 @@ def test_glob_recursive(self, alpharep):
475
475
476
476
assert list (root .glob ("**/*.txt" )) == list (root .rglob ("*.txt" ))
477
477
478
+ @pass_alpharep
479
+ def test_glob_dirs (self , alpharep ):
480
+ root = zipfile .Path (alpharep )
481
+ assert list (root .glob ('b' )) == [zipfile .Path (alpharep , "b/" )]
482
+ assert list (root .glob ('b*' )) == [zipfile .Path (alpharep , "b/" )]
483
+
484
+ @pass_alpharep
485
+ def test_glob_subdir (self , alpharep ):
486
+ root = zipfile .Path (alpharep )
487
+ assert list (root .glob ('g/h' )) == [zipfile .Path (alpharep , "g/h/" )]
488
+ assert list (root .glob ('g*/h*' )) == [zipfile .Path (alpharep , "g/h/" )]
489
+
478
490
@pass_alpharep
479
491
def test_glob_subdirs (self , alpharep ):
480
492
root = zipfile .Path (alpharep )
@@ -594,3 +606,10 @@ def test_malformed_paths(self):
594
606
'two-slash.txt' ,
595
607
'parent.txt' ,
596
608
]
609
+
610
+ @pass_alpharep
611
+ def test_interface (self , alpharep ):
612
+ from importlib .resources .abc import Traversable
613
+
614
+ zf = zipfile .Path (alpharep )
615
+ assert isinstance (zf , Traversable )
0 commit comments