def test_normalize(): assert paths.normalize("/") == "/" assert paths.normalize("/a/../") == "/" assert paths.normalize("/a/b/c") == "/a/b/c" assert paths.normalize("/a/b/c/") == "/a/b/c/" assert paths.normalize("/a/b/../c") == "/a/c" assert paths.normalize("/a/b/../c/") == "/a/c/" assert paths.normalize("/.") == "/" assert paths.normalize("/./") == "/" assert paths.normalize("/a/.") == "/a/" assert paths.normalize("/a/b/./c") == "/a/b/c" assert paths.normalize("/a/b/./c/") == "/a/b/c/" assert paths.normalize("/a/b//c") == "/a/b/c" assert paths.normalize("//a/b//c") == "/a/b/c" assert paths.normalize("//a/b//c//") == "/a/b/c/" with nose.tools.assert_raises(ValueError): _ = paths.normalize_abs("") with nose.tools.assert_raises(ValueError): _ = paths.normalize_abs("a/b/c") assert paths.normalize("/../a") == "/a" assert paths.normalize("/a/b/../../..") == "/"
def zipname(path): return paths.normalize_abs(path)[1:]
def file_path(self, path): path = paths.normalize_abs(path) return os.path.join(self.dirpath, path[1:])