2 from test
import test_support
, test_genericpath
6 class MacPathTestCase(unittest
.TestCase
):
8 def test_abspath(self
):
9 self
.assertEqual(macpath
.abspath("xx:yy"), "xx:yy")
13 self
.assertTrue(isabs("xx:yy"))
14 self
.assertTrue(isabs("xx:yy:"))
15 self
.assertTrue(isabs("xx:"))
16 self
.assertFalse(isabs("foo"))
17 self
.assertFalse(isabs(":foo"))
18 self
.assertFalse(isabs(":foo:bar"))
19 self
.assertFalse(isabs(":foo:bar:"))
23 self
.assertEqual(split("foo:bar"),
25 self
.assertEqual(split("conky:mountpoint:foo:bar"),
26 ('conky:mountpoint:foo', 'bar'))
28 self
.assertEqual(split(":"), ('', ''))
29 self
.assertEqual(split(":conky:mountpoint:"),
30 (':conky:mountpoint', ''))
32 def test_splitext(self
):
33 splitext
= macpath
.splitext
34 self
.assertEqual(splitext(":foo.ext"), (':foo', '.ext'))
35 self
.assertEqual(splitext("foo:foo.ext"), ('foo:foo', '.ext'))
36 self
.assertEqual(splitext(".ext"), ('.ext', ''))
37 self
.assertEqual(splitext("foo.ext:foo"), ('foo.ext:foo', ''))
38 self
.assertEqual(splitext(":foo.ext:"), (':foo.ext:', ''))
39 self
.assertEqual(splitext(""), ('', ''))
40 self
.assertEqual(splitext("foo.bar.ext"), ('foo.bar', '.ext'))
42 def test_normpath(self
):
43 # Issue 5827: Make sure normpath preserves unicode
44 for path
in (u
'', u
'.', u
'/', u
'\\', u
':', u
'///foo/.//bar//'):
45 self
.assertIsInstance(macpath
.normpath(path
), unicode,
46 'normpath() returned str instead of unicode')
48 class MacCommonTest(test_genericpath
.CommonTest
):
53 test_support
.run_unittest(MacPathTestCase
, MacCommonTest
)
56 if __name__
== "__main__":