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

Unified Diff: Lib/test/test_macpath.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_macpath.py
===================================================================
--- Lib/test/test_macpath.py (revision 67929)
+++ Lib/test/test_macpath.py (working copy)
@@ -43,6 +43,37 @@
self.assert_(commonprefix([b":home:swen:spam", b":home:swen:spam"])
== b":home:swen:spam")
+ def test_commonpathprefix(self):
+ commonpathprefix = macpath.commonpathprefix
+ self.assertEqual(
+ commonpathprefix([]),
+ ""
+ )
+ self.assertEqual(
+ commonpathprefix([":home:swenson:spam", ":home:swen:spam"]),
+ ":home"
+ )
+ self.assertEqual(
+ commonpathprefix([":home:swen:spam", ":home:swen:eggs"]),
+ ":home:swen"
+ )
+ self.assertEqual(
+ commonpathprefix([":home:swen:spam", ":home:swen:spam"]),
+ ":home:swen:spam"
+ )
+ self.assertEqual(
+ commonpathprefix([":home:swen:spam", "swen:spam"]),
+ ""
+ )
+ self.assertEqual(
+ commonpathprefix(["swen:eggs", "swen:spam"]),
+ "swen"
+ )
+ self.assertEqual(
+ commonpathprefix([":export:home:swen", ":etc:passwd"]),
+ ""
+ )
+
def test_split(self):
split = macpath.split
self.assertEquals(split("foo:bar"),

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