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

Unified Diff: Lib/test/test_genericpath.py

Issue 4755: Common path prefix
Patch Set: Created 10 years, 10 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_genericpath.py
===================================================================
--- Lib/test/test_genericpath.py (revision 67929)
+++ Lib/test/test_genericpath.py (working copy)
@@ -25,7 +25,56 @@
genericpath.commonprefix(["/home/swen/spam", "/home/swen/spam"]),
"/home/swen/spam"
)
+ self.assertEqual(
+ genericpath.commonprefix(["/export/home/swen", "/etc/passwd"]),
+ "/e"
+ )
+ def test_commonpathprefix(self):
+ self.assertEqual(
+ genericpath.commonpathprefix([]),
+ ""
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["/home/swenson/spam",
+ "/home/swen/spam"]),
+ "/home"
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["/home/swenson/spam",
+ "/home/swen/spam"], ":"),
+ ""
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["WhomeWswensonWspam",
+ "WhomeWswenWspam"], "W"),
+ "Whome"
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["/home/swen/spam",
+ "/home/swen/eggs"]),
+ "/home/swen"
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["/home/swen/spam",
+ "/home/swen/spam"]),
+ "/home/swen/spam"
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["/home/swen/spam",
+ "swen/spam"]),
+ ""
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["swen/eggs",
+ "swen/spam"]),
+ "swen"
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["/export/home/swen", "/etc/passwd"]),
+ ""
+ )
+
def test_getsize(self):
f = open(support.TESTFN, "wb")
try:
« Doc/library/os.path.rst ('K') | « Lib/os2emxpath.py ('k') | Lib/test/test_macpath.py » ('j') | no next file with comments »

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