def test_parse_file_path(): rpath = '/a/b/c' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname = ops.parse_file_path(path) assert fshare == 'a' assert dir == 'b' assert fname == 'c' rpath = 'a/b/c/d' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname = ops.parse_file_path(path) assert fshare == 'a' assert dir == 'b/c' assert fname == 'd' rpath = 'a/b' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname = ops.parse_file_path(path) assert fshare == 'a' assert dir is None assert fname == 'b' rpath = 'a' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname = ops.parse_file_path(path) assert fshare == 'a' assert dir is None assert fname is None
def test_parse_file_path(): rpath = '/a/b/c' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname, ss = ops.parse_file_path(path) assert fshare == 'a' assert dir == 'b' assert fname == 'c' assert ss is None rpath = '/a/b/c?sharesnapshot=2017-10-25T21:17:42.0000000Z' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname, ss = ops.parse_file_path(path) assert fshare == 'a' assert dir == 'b' assert fname == 'c' assert ss == '2017-10-25T21:17:42.0000000Z' rpath = 'a/b/c/d' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname, ss = ops.parse_file_path(path) assert fshare == 'a' assert dir == 'b/c' assert fname == 'd' assert ss is None rpath = 'a/b/c/d?sharesnapshot=2017-10-25T21:17:42.0000000Z' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname, ss = ops.parse_file_path(path) assert fshare == 'a' assert dir == 'b/c' assert fname == 'd' assert ss == '2017-10-25T21:17:42.0000000Z' rpath = 'a/b' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname, ss = ops.parse_file_path(path) assert fshare == 'a' assert dir is None assert fname == 'b' assert ss is None rpath = 'a/b?sharesnapshot=2017-10-25T21:17:42.0000000Z' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname, ss = ops.parse_file_path(path) assert fshare == 'a' assert dir is None assert fname == 'b' assert ss == '2017-10-25T21:17:42.0000000Z' rpath = 'a' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname, ss = ops.parse_file_path(path) assert fshare == 'a' assert dir is None assert fname is None assert ss is None rpath = 'a?snapshot=2017-10-25T21:17:42.0000000Z' fshare, path = util.explode_azure_path(util.normalize_azure_path(rpath)) dir, fname, ss = ops.parse_file_path(path) assert fshare == 'a?snapshot=2017-10-25T21:17:42.0000000Z' assert dir is None assert fname is None assert ss is None