summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-05-11 17:59:59 (GMT)
committerRaymond Hettinger <python@rcn.com>2007-05-11 17:59:59 (GMT)
commita74b67e15e19e2ba95e66e5a9ac233b4e1f79d68 (patch)
treef5196efbf909a024f527a771b8361278be320e91 /Lib
parente3e62b378336ee81b8e4b51247a3b32e4c35d74d (diff)
downloadcpython-a74b67e15e19e2ba95e66e5a9ac233b4e1f79d68.zip
cpython-a74b67e15e19e2ba95e66e5a9ac233b4e1f79d68.tar.gz
cpython-a74b67e15e19e2ba95e66e5a9ac233b4e1f79d68.tar.bz2
Better tests for posixpath.commonprefix
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_posixpath.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 0abf464..88aa68c 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -130,6 +130,16 @@ class PosixPathTest(unittest.TestCase):
"/home/swen/spam"
)
+ testlist = ['', 'abc', 'Xbcd', 'Xb', 'XY', 'abcd', 'aXc', 'abd', 'ab', 'aX', 'abcX']
+ for s1 in testlist:
+ for s2 in testlist:
+ p = posixpath.commonprefix([s1, s2])
+ self.assert_(s1.startswith(p))
+ self.assert_(s2.startswith(p))
+ if s1 != s2:
+ n = len(p)
+ self.assertNotEqual(s1[n:n+1], s2[n:n+1])
+
def test_getsize(self):
f = open(test_support.TESTFN, "wb")
try: