Create test_genericpath.CommonTest and reuse it to test other path modules.

This commit is contained in:
Florent Xicluna 2010-03-06 18:07:18 +00:00
parent 58526417ed
commit dc1531c5c4
4 changed files with 163 additions and 323 deletions

View file

@ -1,7 +1,6 @@
import macpath
from test import test_support
from test import test_support, test_genericpath
import unittest
import test_genericpath
class MacPathTestCase(unittest.TestCase):
@ -9,12 +8,6 @@ class MacPathTestCase(unittest.TestCase):
def test_abspath(self):
self.assertEqual(macpath.abspath("xx:yy"), "xx:yy")
def test_abspath_with_ascii_cwd(self):
test_genericpath._issue3426(self, u'cwd', macpath.abspath)
def test_abspath_with_nonascii_cwd(self):
test_genericpath._issue3426(self, u'\xe7w\xf0', macpath.abspath)
def test_isabs(self):
isabs = macpath.isabs
self.assertTrue(isabs("xx:yy"))
@ -46,11 +39,6 @@ class MacPathTestCase(unittest.TestCase):
self.assertEqual(split(":conky:mountpoint:"),
(':conky:mountpoint', ''))
def test_splitdrive(self):
splitdrive = macpath.splitdrive
self.assertEqual(splitdrive("foo:bar"), ('', 'foo:bar'))
self.assertEqual(splitdrive(":foo:bar"), ('', ':foo:bar'))
def test_splitext(self):
splitext = macpath.splitext
self.assertEqual(splitext(":foo.ext"), (':foo', '.ext'))
@ -67,9 +55,12 @@ class MacPathTestCase(unittest.TestCase):
self.assertIsInstance(macpath.normpath(path), unicode,
'normpath() returned str instead of unicode')
class MacCommonTest(test_genericpath.CommonTest):
path = macpath
def test_main():
test_support.run_unittest(MacPathTestCase)
test_support.run_unittest(MacPathTestCase, MacCommonTest)
if __name__ == "__main__":