mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #5117: Fixed root directory related issue on posixpath.relpath() and
ntpath.relpath().
This commit is contained in:
parent
0491047580
commit
50f7d7e213
5 changed files with 26 additions and 4 deletions
|
@ -322,6 +322,15 @@ class PosixPathTest(unittest.TestCase):
|
|||
self.assertEqual(posixpath.relpath("a/b", "../c"), "../"+curdir+"/a/b")
|
||||
self.assertEqual(posixpath.relpath("a", "b/c"), "../../a")
|
||||
self.assertEqual(posixpath.relpath("a", "a"), ".")
|
||||
self.assertEqual(posixpath.relpath("/foo/bar/bat", "/x/y/z"), '../../../foo/bar/bat')
|
||||
self.assertEqual(posixpath.relpath("/foo/bar/bat", "/foo/bar"), 'bat')
|
||||
self.assertEqual(posixpath.relpath("/foo/bar/bat", "/"), 'foo/bar/bat')
|
||||
self.assertEqual(posixpath.relpath("/", "/foo/bar/bat"), '../../..')
|
||||
self.assertEqual(posixpath.relpath("/foo/bar/bat", "/x"), '../foo/bar/bat')
|
||||
self.assertEqual(posixpath.relpath("/x", "/foo/bar/bat"), '../../../x')
|
||||
self.assertEqual(posixpath.relpath("/", "/"), '.')
|
||||
self.assertEqual(posixpath.relpath("/a", "/a"), '.')
|
||||
self.assertEqual(posixpath.relpath("/a/b", "/a/b"), '.')
|
||||
finally:
|
||||
os.getcwd = real_getcwd
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue