summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posixpath.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-08 12:42:20 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-08 12:42:20 (GMT)
commite3ed2e02be2df49f040ea1560a86727bf7a99fee (patch)
treebd4c840d1aa6f3ffd104d1364a5388fc2a8f55cd /Lib/test/test_posixpath.py
parent19b02d4558515e761755346dd1c119cf6ad55352 (diff)
downloadcpython-e3ed2e02be2df49f040ea1560a86727bf7a99fee.zip
cpython-e3ed2e02be2df49f040ea1560a86727bf7a99fee.tar.gz
cpython-e3ed2e02be2df49f040ea1560a86727bf7a99fee.tar.bz2
Merge other tests from test_*path.py into test_genericpath.CommonTest, and do some cleanup.
Diffstat (limited to 'Lib/test/test_posixpath.py')
-rw-r--r--Lib/test/test_posixpath.py72
1 files changed, 0 insertions, 72 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 2d845a8..be0afd0 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -136,78 +136,6 @@ class PosixPathTest(unittest.TestCase):
self.assertEqual(posixpath.dirname(b"////foo"), b"////")
self.assertEqual(posixpath.dirname(b"//foo//bar"), b"//foo")
- def test_commonprefix(self):
- self.assertEqual(
- posixpath.commonprefix([]),
- ""
- )
- self.assertEqual(
- posixpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"]),
- "/home/swen"
- )
- self.assertEqual(
- posixpath.commonprefix(["/home/swen/spam", "/home/swen/eggs"]),
- "/home/swen/"
- )
- self.assertEqual(
- posixpath.commonprefix(["/home/swen/spam", "/home/swen/spam"]),
- "/home/swen/spam"
- )
-
- self.assertEqual(
- posixpath.commonprefix([b"/home/swenson/spam", b"/home/swen/spam"]),
- b"/home/swen"
- )
- self.assertEqual(
- posixpath.commonprefix([b"/home/swen/spam", b"/home/swen/eggs"]),
- b"/home/swen/"
- )
- self.assertEqual(
- posixpath.commonprefix([b"/home/swen/spam", b"/home/swen/spam"]),
- b"/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.assertTrue(s1.startswith(p))
- self.assertTrue(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(support.TESTFN, "wb")
- try:
- f.write(b"foo")
- f.close()
- self.assertEqual(posixpath.getsize(support.TESTFN), 3)
- finally:
- if not f.closed:
- f.close()
-
- def test_time(self):
- f = open(support.TESTFN, "wb")
- try:
- f.write(b"foo")
- f.close()
- f = open(support.TESTFN, "ab")
- f.write(b"bar")
- f.close()
- f = open(support.TESTFN, "rb")
- d = f.read()
- f.close()
- self.assertEqual(d, b"foobar")
-
- self.assertLessEqual(
- posixpath.getctime(support.TESTFN),
- posixpath.getmtime(support.TESTFN)
- )
- finally:
- if not f.closed:
- f.close()
-
def test_islink(self):
self.assertIs(posixpath.islink(support.TESTFN + "1"), False)
f = open(support.TESTFN + "1", "wb")