Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(59372)

Unified Diff: Lib/test/test_ntpath.py

Issue 4755: Common path prefix
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Lib/test/test_ntpath.py
===================================================================
--- Lib/test/test_ntpath.py (revision 67929)
+++ Lib/test/test_ntpath.py (working copy)
@@ -73,6 +73,40 @@
tester('ntpath.isabs("\\foo")', 1)
tester('ntpath.isabs("\\foo\\bar")', 1)
+ def test_commonpathprefix(self):
+ self.assertEqual(ntpath.commonpathprefix([]), "")
+ self.assertEqual(ntpath.commonpathprefix(["/home/swenson/spam",
+ "/home/swen/spam"]),
+ "\\home")
+ self.assertEqual(ntpath.commonpathprefix(["\\home\\swenson\\spam",
+ "\\home\\swen\\spam"]),
+ "\\home")
+ self.assertEqual(
+ ntpath.commonpathprefix(["\\home\\swen\\spam",
+ "\\home\\swen\\eggs"]),
+ "\\home\\swen"
+ )
+ self.assertEqual(
+ ntpath.commonpathprefix(["\\home\\swen\\spam",
+ "\\home\\swen\\spam"]),
+ "\\home\\swen\\spam"
+ )
+ self.assertEqual(
+ ntpath.commonpathprefix(["\\home\\swen\\spam",
+ "swen\\spam"]),
+ ""
+ )
+ self.assertEqual(
+ ntpath.commonpathprefix(["swen\\eggs",
+ "swen\\spam"]),
+ "swen"
+ )
+ self.assertEqual(
+ ntpath.commonpathprefix(["\\export\\home\\swen",
+ "\\etc\\passwd"]),
+ ""
+ )
+
def test_commonprefix(self):
tester('ntpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])',
"/home/swen")

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+