diff options
author | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> | 2010-10-18 13:49:09 +0000 |
---|---|---|
committer | Hirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp> | 2010-10-18 13:49:09 +0000 |
commit | 089144e511ca4b388ce8b29ecf2965a8215ff238 (patch) | |
tree | 2cb4c09dc5d4bca6972fd590bae549e0b386ad89 /Lib/test | |
parent | fd6a55ec41fe2bd46cf0a5b4ebabb62eda5a19d7 (diff) | |
download | cpython-git-089144e511ca4b388ce8b29ecf2965a8215ff238.tar.gz |
Merged revisions 85689 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r85689 | hirokazu.yamamoto | 2010-10-18 21:13:18 +0900 | 3 lines
Issue #5117: Case normalization was needed on ntpath.relpath(). And
fixed root directory issue on posixpath.relpath(). (Ported working fixes
from ntpath)
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ntpath.py | 1 | ||||
-rw-r--r-- | Lib/test/test_posixpath.py | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py index 8ff7075ae5..3d18527243 100644 --- a/Lib/test/test_ntpath.py +++ b/Lib/test/test_ntpath.py @@ -236,6 +236,7 @@ class TestNtpath(unittest.TestCase): tester('ntpath.relpath("/", "/")', '.') tester('ntpath.relpath("/a", "/a")', '.') tester('ntpath.relpath("/a/b", "/a/b")', '.') + tester('ntpath.relpath("c:/foo", "C:/FOO")', '.') def test_main(): diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index 0efe3ff656..6123ae2590 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -602,6 +602,15 @@ class PosixPathTest(unittest.TestCase): "../"+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 @@ -620,6 +629,15 @@ class PosixPathTest(unittest.TestCase): b"../"+curdir+b"/a/b") self.assertEqual(posixpath.relpath(b"a", b"b/c"), b"../../a") self.assertEqual(posixpath.relpath(b"a", b"a"), b".") + self.assertEqual(posixpath.relpath(b"/foo/bar/bat", b"/x/y/z"), b'../../../foo/bar/bat') + self.assertEqual(posixpath.relpath(b"/foo/bar/bat", b"/foo/bar"), b'bat') + self.assertEqual(posixpath.relpath(b"/foo/bar/bat", b"/"), b'foo/bar/bat') + self.assertEqual(posixpath.relpath(b"/", b"/foo/bar/bat"), b'../../..') + self.assertEqual(posixpath.relpath(b"/foo/bar/bat", b"/x"), b'../foo/bar/bat') + self.assertEqual(posixpath.relpath(b"/x", b"/foo/bar/bat"), b'../../../x') + self.assertEqual(posixpath.relpath(b"/", b"/"), b'.') + self.assertEqual(posixpath.relpath(b"/a", b"/a"), b'.') + self.assertEqual(posixpath.relpath(b"/a/b", b"/a/b"), b'.') self.assertRaises(TypeError, posixpath.relpath, b"bytes", "str") self.assertRaises(TypeError, posixpath.relpath, "str", b"bytes") |