File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2514,5 +2514,16 @@ def test_parent(self):
2514
2514
assert (root / 'a' ).parent .at == ''
2515
2515
assert (root / 'a' / 'b' ).parent .at == 'a/'
2516
2516
2517
+ def test_dir_parent (self ):
2518
+ for zipfile_abcde in self .zipfile_abcde ():
2519
+ root = zipfile .Path (zipfile_abcde )
2520
+ assert (root / 'b' ).parent .at == ''
2521
+ assert (root / 'b/' ).parent .at == ''
2522
+
2523
+ def test_missing_dir_parent (self ):
2524
+ for zipfile_abcde in self .zipfile_abcde ():
2525
+ root = zipfile .Path (zipfile_abcde )
2526
+ assert (root / 'missing dir/' ).parent .at == ''
2527
+
2517
2528
if __name__ == "__main__" :
2518
2529
unittest .main ()
Original file line number Diff line number Diff line change @@ -2236,7 +2236,7 @@ def _add_implied_dirs(names):
2236
2236
2237
2237
@property
2238
2238
def parent (self ):
2239
- parent_at = posixpath .dirname (self .at )
2239
+ parent_at = posixpath .dirname (self .at . rstrip ( '/' ) )
2240
2240
if parent_at :
2241
2241
parent_at += '/'
2242
2242
return self ._next (parent_at )
Original file line number Diff line number Diff line change
1
+ Correct behavior for zipfile.Path.parent when the path object identifies a subdirectory.
You canβt perform that action at this time.
0 commit comments