diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-08 12:42:20 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-08 12:42:20 (GMT) |
commit | e3ed2e02be2df49f040ea1560a86727bf7a99fee (patch) | |
tree | bd4c840d1aa6f3ffd104d1364a5388fc2a8f55cd /Lib/test/test_macpath.py | |
parent | 19b02d4558515e761755346dd1c119cf6ad55352 (diff) | |
download | cpython-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_macpath.py')
-rw-r--r-- | Lib/test/test_macpath.py | 91 |
1 files changed, 33 insertions, 58 deletions
diff --git a/Lib/test/test_macpath.py b/Lib/test/test_macpath.py index b36ba00..d732e14 100644 --- a/Lib/test/test_macpath.py +++ b/Lib/test/test_macpath.py @@ -26,23 +26,6 @@ class MacPathTestCase(unittest.TestCase): self.assertFalse(isabs(b":foo:bar")) self.assertFalse(isabs(b":foo:bar:")) - - def test_commonprefix(self): - commonprefix = macpath.commonprefix - self.assertEqual(commonprefix(["home:swenson:spam", "home:swen:spam"]), - "home:swen") - self.assertEqual(commonprefix([":home:swen:spam", ":home:swen:eggs"]), - ":home:swen:") - self.assertEqual(commonprefix([":home:swen:spam", ":home:swen:spam"]), - ":home:swen:spam") - - self.assertTrue(commonprefix([b"home:swenson:spam", b"home:swen:spam"]) - == b"home:swen") - self.assertTrue(commonprefix([b":home:swen:spam", b":home:swen:eggs"]) - == b":home:swen:") - self.assertTrue(commonprefix([b":home:swen:spam", b":home:swen:spam"]) - == b":home:swen:spam") - def test_split(self): split = macpath.split self.assertEqual(split("foo:bar"), @@ -54,36 +37,28 @@ class MacPathTestCase(unittest.TestCase): self.assertEqual(split(":conky:mountpoint:"), (':conky:mountpoint', '')) - self.assertEquals(split(b"foo:bar"), + self.assertEqual(split(b"foo:bar"), (b'foo:', b'bar')) - self.assertEquals(split(b"conky:mountpoint:foo:bar"), + self.assertEqual(split(b"conky:mountpoint:foo:bar"), (b'conky:mountpoint:foo', b'bar')) - self.assertEquals(split(b":"), (b'', b'')) - self.assertEquals(split(b":conky:mountpoint:"), + self.assertEqual(split(b":"), (b'', b'')) + self.assertEqual(split(b":conky:mountpoint:"), (b':conky:mountpoint', b'')) def test_join(self): join = macpath.join - self.assertEquals(join('a', 'b'), ':a:b') - self.assertEquals(join('', 'a:b'), 'a:b') - self.assertEquals(join('a:b', 'c'), 'a:b:c') - self.assertEquals(join('a:b', ':c'), 'a:b:c') - self.assertEquals(join('a', ':b', ':c'), ':a:b:c') - - self.assertEquals(join(b'a', b'b'), b':a:b') - self.assertEquals(join(b'', b'a:b'), b'a:b') - self.assertEquals(join(b'a:b', b'c'), b'a:b:c') - self.assertEquals(join(b'a:b', b':c'), b'a:b:c') - self.assertEquals(join(b'a', b':b', b':c'), b':a:b:c') - - def test_splitdrive(self): - splitdrive = macpath.splitdrive - self.assertEqual(splitdrive("foo:bar"), ('', 'foo:bar')) - self.assertEqual(splitdrive(":foo:bar"), ('', ':foo:bar')) - - self.assertEquals(splitdrive(b"foo:bar"), (b'', b'foo:bar')) - self.assertEquals(splitdrive(b":foo:bar"), (b'', b':foo:bar')) + self.assertEqual(join('a', 'b'), ':a:b') + self.assertEqual(join('', 'a:b'), 'a:b') + self.assertEqual(join('a:b', 'c'), 'a:b:c') + self.assertEqual(join('a:b', ':c'), 'a:b:c') + self.assertEqual(join('a', ':b', ':c'), ':a:b:c') + + self.assertEqual(join(b'a', b'b'), b':a:b') + self.assertEqual(join(b'', b'a:b'), b'a:b') + self.assertEqual(join(b'a:b', b'c'), b'a:b:c') + self.assertEqual(join(b'a:b', b':c'), b'a:b:c') + self.assertEqual(join(b'a', b':b', b':c'), b':a:b:c') def test_splitext(self): splitext = macpath.splitext @@ -95,27 +70,27 @@ class MacPathTestCase(unittest.TestCase): self.assertEqual(splitext(""), ('', '')) self.assertEqual(splitext("foo.bar.ext"), ('foo.bar', '.ext')) - self.assertEquals(splitext(b":foo.ext"), (b':foo', b'.ext')) - self.assertEquals(splitext(b"foo:foo.ext"), (b'foo:foo', b'.ext')) - self.assertEquals(splitext(b".ext"), (b'.ext', b'')) - self.assertEquals(splitext(b"foo.ext:foo"), (b'foo.ext:foo', b'')) - self.assertEquals(splitext(b":foo.ext:"), (b':foo.ext:', b'')) - self.assertEquals(splitext(b""), (b'', b'')) - self.assertEquals(splitext(b"foo.bar.ext"), (b'foo.bar', b'.ext')) + self.assertEqual(splitext(b":foo.ext"), (b':foo', b'.ext')) + self.assertEqual(splitext(b"foo:foo.ext"), (b'foo:foo', b'.ext')) + self.assertEqual(splitext(b".ext"), (b'.ext', b'')) + self.assertEqual(splitext(b"foo.ext:foo"), (b'foo.ext:foo', b'')) + self.assertEqual(splitext(b":foo.ext:"), (b':foo.ext:', b'')) + self.assertEqual(splitext(b""), (b'', b'')) + self.assertEqual(splitext(b"foo.bar.ext"), (b'foo.bar', b'.ext')) def test_ismount(self): ismount = macpath.ismount - self.assertEquals(ismount("a:"), True) - self.assertEquals(ismount("a:b"), False) - self.assertEquals(ismount("a:b:"), True) - self.assertEquals(ismount(""), False) - self.assertEquals(ismount(":"), False) - - self.assertEquals(ismount(b"a:"), True) - self.assertEquals(ismount(b"a:b"), False) - self.assertEquals(ismount(b"a:b:"), True) - self.assertEquals(ismount(b""), False) - self.assertEquals(ismount(b":"), False) + self.assertEqual(ismount("a:"), True) + self.assertEqual(ismount("a:b"), False) + self.assertEqual(ismount("a:b:"), True) + self.assertEqual(ismount(""), False) + self.assertEqual(ismount(":"), False) + + self.assertEqual(ismount(b"a:"), True) + self.assertEqual(ismount(b"a:b"), False) + self.assertEqual(ismount(b"a:b:"), True) + self.assertEqual(ismount(b""), False) + self.assertEqual(ismount(b":"), False) def test_normpath(self): normpath = macpath.normpath |