def test_get_relpath(): relpath = Path('abc') assert relpath.get_relpath() is relpath assert relpath.get_relpath(os.path.curdir) == relpath cwd = os.getcwd() pardir = os.path.basename(cwd) assert relpath.get_relpath(os.path.pardir) == os.path.join(pardir, 'abc')
def test_get_relpath_nt(): abspath = Path(r'c:\a\x') assert abspath.get_relpath('c:\\a') == 'x' assert abspath.get_relpath('c:\\a\\') == 'x'