def test_process_path_no_escapes_bytes(): for i in range(10): pth = [make_str_for_esc().encode('utf-8') for j in range(10)] beginning = tuple(pth[:-1]) gs = posixpath.join(*beginning).decode('utf-8') ts = pth[-1].decode('utf-8') gname, tname = process_path(pth) assert_equal(gs, gname) assert_equal(ts, tname)
def test_process_path_no_escapes_bytes(): for i in range(10): pth = [make_str_for_esc().encode('utf-8') for j in range(10)] beginning = tuple(pth[:-1]) gs = posixpath.join(*beginning).decode('utf-8') ts = pth[-1].decode('utf-8') gname, tname = process_path(pth) assert_equal(gs, gname) assert_equal(ts, tname)
def test_process_path_leading_periods(): for i in range(10): pth = [make_str_for_esc(include_leading_periods=True) for j in range(10)] beginning = tuple([escape_path(s) for s in pth[:-1]]) gs = posixpath.join(*beginning) ts = escape_path(pth[-1]) gname, tname = process_path(pth) assert_equal(gs, gname) assert_equal(ts, tname)
def test_process_path_escapes_bytes(): for i in range(10): pth = [make_str_for_esc( include_escapes=chars_to_escape).encode('utf-8') for j in range(10)] beginning = tuple([escape_path(s) for s in pth[:-1]]) gs = posixpath.join(*beginning) ts = escape_path(pth[-1]) gname, tname = process_path(pth) assert_equal(gs, gname) assert_equal(ts, tname)