file = cls(alpharep).joinpath('some dir').parent
assert isinstance(file, cls)
+ @pass_alpharep
+ def test_extract_orig_with_implied_dirs(self, alpharep):
+ """
+ A zip file wrapped in a Path should extract even with implied dirs.
+ """
+ source_path = self.zipfile_ondisk(alpharep)
+ zf = zipfile.ZipFile(source_path)
+ # wrap the zipfile for its side effect
+ zipfile.Path(zf)
+ zf.extractall(source_path.parent)
+
if __name__ == "__main__":
unittest.main()
dir_match = name not in names and dirname in names
return dirname if dir_match else name
+ def getinfo(self, name):
+ """
+ Supplement getinfo for implied dirs.
+ """
+ try:
+ return super().getinfo(name)
+ except KeyError:
+ if not name.endswith('/') or name not in self._name_set():
+ raise
+ return ZipInfo(filename=name)
+
@classmethod
def make(cls, source):
"""