Null commit with -f option to force an uprev and put HEADs firmly on the trunk.
[python/dscho.git] / Lib / test / test_dospath.py
blob74bdd4a12a9a344694b6f75a2251ddaf29eaa264
1 import dospath
2 import test_support
3 import unittest
6 class DOSPathTestCase(unittest.TestCase):
8 def test_abspath(self):
9 self.assert_(dospath.abspath("C:\\") == "C:\\")
11 def test_isabs(self):
12 isabs = dospath.isabs
13 self.assert_(isabs("c:\\"))
14 self.assert_(isabs("\\\\conky\\mountpoint\\"))
15 self.assert_(isabs("\\foo"))
16 self.assert_(isabs("\\foo\\bar"))
17 self.failIf(isabs("foo"))
18 self.failIf(isabs("foo\\"))
19 self.failIf(isabs("foo\\bar"))
20 self.failIf(isabs("c:foo"))
21 self.failIf(isabs("c:foo\\"))
22 self.failIf(isabs("c:foo\\bar"))
24 def test_commonprefix(self):
25 commonprefix = dospath.commonprefix
26 self.assert_(commonprefix(["/home/swenson/spam", "/home/swen/spam"])
27 == "/home/swen")
28 self.assert_(commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])
29 == "\\home\\swen\\")
30 self.assert_(commonprefix(["/home/swen/spam", "/home/swen/spam"])
31 == "/home/swen/spam")
33 def test_split(self):
34 split = dospath.split
35 self.assertEquals(split("c:\\foo\\bar"),
36 ('c:\\foo', 'bar'))
37 self.assertEquals(split("\\\\conky\\mountpoint\\foo\\bar"),
38 ('\\\\conky\\mountpoint\\foo', 'bar'))
40 self.assertEquals(split("c:\\"), ('c:\\', ''))
41 self.assertEquals(split("\\\\conky\\mountpoint\\"),
42 ('\\\\conky\\mountpoint', ''))
44 self.assertEquals(split("c:/"), ('c:/', ''))
45 self.assertEquals(split("//conky/mountpoint/"),
46 ('//conky/mountpoint', ''))
48 def test_splitdrive(self):
49 splitdrive = dospath.splitdrive
50 self.assertEquals(splitdrive("c:\\foo\\bar"), ('c:', '\\foo\\bar'))
51 self.assertEquals(splitdrive("c:/foo/bar"), ('c:', '/foo/bar'))
52 self.assertEquals(splitdrive("foo\\bar"), ('', 'foo\\bar'))
53 self.assertEquals(splitdrive("c:"), ('c:', ''))
56 test_support.run_unittest(DOSPathTestCase)