2 from test
import test_support
6 class MacPathTestCase(unittest
.TestCase
):
8 def test_abspath(self
):
9 self
.assert_(macpath
.abspath("xx:yy") == "xx:yy")
13 self
.assert_(isabs("xx:yy"))
14 self
.assert_(isabs("xx:yy:"))
15 self
.assert_(isabs("xx:"))
16 self
.failIf(isabs("foo"))
17 self
.failIf(isabs(":foo"))
18 self
.failIf(isabs(":foo:bar"))
19 self
.failIf(isabs(":foo:bar:"))
22 def test_commonprefix(self
):
23 commonprefix
= macpath
.commonprefix
24 self
.assert_(commonprefix(["home:swenson:spam", "home:swen:spam"])
26 self
.assert_(commonprefix([":home:swen:spam", ":home:swen:eggs"])
28 self
.assert_(commonprefix([":home:swen:spam", ":home:swen:spam"])
33 self
.assertEquals(split("foo:bar"),
35 self
.assertEquals(split("conky:mountpoint:foo:bar"),
36 ('conky:mountpoint:foo', 'bar'))
38 self
.assertEquals(split(":"), ('', ''))
39 self
.assertEquals(split(":conky:mountpoint:"),
40 (':conky:mountpoint', ''))
42 def test_splitdrive(self
):
43 splitdrive
= macpath
.splitdrive
44 self
.assertEquals(splitdrive("foo:bar"), ('', 'foo:bar'))
45 self
.assertEquals(splitdrive(":foo:bar"), ('', ':foo:bar'))
47 def test_splitext(self
):
48 splitext
= macpath
.splitext
49 self
.assertEquals(splitext(":foo.ext"), (':foo', '.ext'))
50 self
.assertEquals(splitext("foo:foo.ext"), ('foo:foo', '.ext'))
51 self
.assertEquals(splitext(".ext"), ('.ext', ''))
52 self
.assertEquals(splitext("foo.ext:foo"), ('foo.ext:foo', ''))
53 self
.assertEquals(splitext(":foo.ext:"), (':foo.ext:', ''))
54 self
.assertEquals(splitext(""), ('', ''))
55 self
.assertEquals(splitext("foo.bar.ext"), ('foo.bar', '.ext'))
59 test_support
.run_unittest(MacPathTestCase
)
62 if __name__
== "__main__":