diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2007-03-07 11:04:33 (GMT) | 
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2007-03-07 11:04:33 (GMT) | 
| commit | 05c075d629fc81035b438e3b146872dc7799f260 (patch) | |
| tree | 4240955ee3ea5894d0c068c9669244a7200e768c /Lib/test/test_posixpath.py | |
| parent | f08c073ded5a7cf5786f9a561e3d9529def81b6e (diff) | |
| download | cpython-05c075d629fc81035b438e3b146872dc7799f260.zip cpython-05c075d629fc81035b438e3b146872dc7799f260.tar.gz cpython-05c075d629fc81035b438e3b146872dc7799f260.tar.bz2  | |
Bug #1115886: os.path.splitext('.cshrc') gives now ('.cshrc', '').
Diffstat (limited to 'Lib/test/test_posixpath.py')
| -rw-r--r-- | Lib/test/test_posixpath.py | 28 | 
1 files changed, 20 insertions, 8 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index 20a1fc5..d34c7e2 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -43,15 +43,27 @@ class PosixPathTest(unittest.TestCase):          self.assertRaises(TypeError, posixpath.split) -    def test_splitext(self): -        self.assertEqual(posixpath.splitext("foo.ext"), ("foo", ".ext")) -        self.assertEqual(posixpath.splitext("/foo/foo.ext"), ("/foo/foo", ".ext")) -        self.assertEqual(posixpath.splitext(".ext"), ("", ".ext")) -        self.assertEqual(posixpath.splitext("/foo.ext/foo"), ("/foo.ext/foo", "")) -        self.assertEqual(posixpath.splitext("foo.ext/"), ("foo.ext/", "")) -        self.assertEqual(posixpath.splitext(""), ("", "")) -        self.assertEqual(posixpath.splitext("foo.bar.ext"), ("foo.bar", ".ext")) +    def splitextTest(self, path, filename, ext): +        self.assertEqual(posixpath.splitext(path), (filename, ext)) +        self.assertEqual(posixpath.splitext("/" + path), ("/" + filename, ext)) +        self.assertEqual(posixpath.splitext("abc/" + path), ("abc/" + filename, ext)) +        self.assertEqual(posixpath.splitext("abc.def/" + path), ("abc.def/" + filename, ext)) +        self.assertEqual(posixpath.splitext("/abc.def/" + path), ("/abc.def/" + filename, ext)) +        self.assertEqual(posixpath.splitext(path + "/"), (filename + ext + "/", "")) +    def test_splitext(self): +        self.splitextTest("foo.bar", "foo", ".bar") +        self.splitextTest("foo.boo.bar", "foo.boo", ".bar") +        self.splitextTest("foo.boo.biff.bar", "foo.boo.biff", ".bar") +        self.splitextTest(".csh.rc", ".csh", ".rc") +        self.splitextTest("nodots", "nodots", "") +        self.splitextTest(".cshrc", ".cshrc", "") +        self.splitextTest("...manydots", "...manydots", "") +        self.splitextTest("...manydots.ext", "...manydots", ".ext") +        self.splitextTest(".", ".", "") +        self.splitextTest("..", "..", "") +        self.splitextTest("........", "........", "") +        self.splitextTest("", "", "")          self.assertRaises(TypeError, posixpath.splitext)      def test_isabs(self):  | 
