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

Unified Diff: Lib/test/test_posixpath.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
« Doc/library/os.path.rst ('K') | « Lib/test/test_ntpath.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Lib/test/test_posixpath.py
===================================================================
--- Lib/test/test_posixpath.py (revision 67929)
+++ Lib/test/test_posixpath.py (working copy)
@@ -165,6 +165,41 @@
self.assertRaises(TypeError, posixpath.dirname)
+ def test_commonpathprefix(self):
+ self.assertEqual(
+ genericpath.commonpathprefix([]),
+ ""
+ )
+ self.assertEqual(
+ genericpath.commonpathprefix(["/home/swenson/spam",
+ "/home/swen/spam"]),
+ "/home"
+ )
+ 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.commonprefix(["/export/home/swen", "/etc/passwd"]),
+ ""
+ )
+
def test_commonprefix(self):
self.assertEqual(
posixpath.commonprefix([]),
« Doc/library/os.path.rst ('K') | « Lib/test/test_ntpath.py ('k') | no next file » | no next file with comments »

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