summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ntpath.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-03-16 22:16:08 (GMT)
committerCollin Winter <collinw@gmail.com>2007-03-16 22:16:08 (GMT)
commit6f187743ffbce522c9d686ae5393272c1eb85dcc (patch)
tree49954823525566e80d435c3f9acff30a1a54e58d /Lib/test/test_ntpath.py
parent6de691d78ce696d897e4c58c3fc8fd7d3f6f1359 (diff)
downloadcpython-6f187743ffbce522c9d686ae5393272c1eb85dcc.zip
cpython-6f187743ffbce522c9d686ae5393272c1eb85dcc.tar.gz
cpython-6f187743ffbce522c9d686ae5393272c1eb85dcc.tar.bz2
Patch 1339796: add a relpath() function to os.path.
Diffstat (limited to 'Lib/test/test_ntpath.py')
-rw-r--r--Lib/test/test_ntpath.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index 703e5c8..6af9c85 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -157,6 +157,16 @@ except ImportError:
else:
tester('ntpath.abspath("C:\\")', "C:\\")
+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')
+
if errors:
raise TestFailed(str(errors) + " errors.")
elif verbose: