Python ntpath.relpath() Examples
The following are 11
code examples of ntpath.relpath().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
ntpath
, or try the search function
.
Example #1
Source File: test_ntpath.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_relpath(self): tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') with test_support.temp_cwd(test_support.TESTFN) as cwd_dir: currentdir = os.path.basename(cwd_dir) tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #2
Source File: test_ntpath.py From BinderFilter with MIT License | 6 votes |
def test_relpath(self): currentdir = os.path.split(os.getcwd())[-1] tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #3
Source File: test_ntpath.py From oss-ftp with MIT License | 6 votes |
def test_relpath(self): currentdir = os.path.split(os.getcwd())[-1] tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #4
Source File: test_ntpath.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_relpath(self): tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') with support.temp_cwd(support.TESTFN) as cwd_dir: currentdir = os.path.basename(cwd_dir) tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("c:/foo/bar/bat", "c:/x/y")', '..\\..\\foo\\bar\\bat') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #5
Source File: test_ntpath.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_relpath(self): tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') with support.temp_cwd(support.TESTFN) as cwd_dir: currentdir = os.path.basename(cwd_dir) tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("c:/foo/bar/bat", "c:/x/y")', '..\\..\\foo\\bar\\bat') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #6
Source File: test_ntpath.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_relpath(self): currentdir = os.path.split(os.getcwd())[-1] tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #7
Source File: test_ntpath.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_relpath(self): tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') with support.temp_cwd(support.TESTFN) as cwd_dir: currentdir = os.path.basename(cwd_dir) tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("c:/foo/bar/bat", "c:/x/y")', '..\\..\\foo\\bar\\bat') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #8
Source File: test_ntpath.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_relpath(self): currentdir = os.path.split(os.getcwd())[-1] tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #9
Source File: test_ntpath.py From android_universal with MIT License | 6 votes |
def test_relpath(self): tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') with support.temp_cwd(support.TESTFN) as cwd_dir: currentdir = os.path.basename(cwd_dir) tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("c:/foo/bar/bat", "c:/x/y")', '..\\..\\foo\\bar\\bat') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #10
Source File: test_ntpath.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def test_relpath(self): currentdir = os.path.split(os.getcwd())[-1] tester('ntpath.relpath("a")', 'a') tester('ntpath.relpath(os.path.abspath("a"))', 'a') tester('ntpath.relpath("a/b")', 'a\\b') tester('ntpath.relpath("../a/b")', '..\\a\\b') tester('ntpath.relpath("a", "../b")', '..\\'+currentdir+'\\a') tester('ntpath.relpath("a/b", "../c")', '..\\'+currentdir+'\\a\\b') tester('ntpath.relpath("a", "b/c")', '..\\..\\a') tester('ntpath.relpath("//conky/mountpoint/a", "//conky/mountpoint/b/c")', '..\\..\\a') tester('ntpath.relpath("a", "a")', '.') tester('ntpath.relpath("/foo/bar/bat", "/x/y/z")', '..\\..\\..\\foo\\bar\\bat') tester('ntpath.relpath("/foo/bar/bat", "/foo/bar")', 'bat') tester('ntpath.relpath("/foo/bar/bat", "/")', 'foo\\bar\\bat') tester('ntpath.relpath("/", "/foo/bar/bat")', '..\\..\\..') tester('ntpath.relpath("/foo/bar/bat", "/x")', '..\\foo\\bar\\bat') tester('ntpath.relpath("/x", "/foo/bar/bat")', '..\\..\\..\\x') tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') tester('ntpath.relpath("c:/foo", "C:/FOO")', '.')
Example #11
Source File: test_ntpath.py From android_universal with MIT License | 5 votes |
def test_path_relpath(self): self.assertPathEqual(self.path.relpath)