diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ntpath.py | 5 | ||||
-rw-r--r-- | Lib/test/test_posixpath.py | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py index ade0790fe3..83d794da54 100644 --- a/Lib/test/test_ntpath.py +++ b/Lib/test/test_ntpath.py @@ -123,6 +123,11 @@ class TestNtpath(unittest.TestCase): tester("ntpath.normpath('C:////a/b')", r'C:\a\b') tester("ntpath.normpath('//machine/share//a/b')", r'\\machine\share\a\b') + # Issue 5827: Make sure normpath preserves unicode + for path in (u'', u'.', u'/', u'\\', u'///foo/.//bar//'): + self.assertTrue(isinstance(ntpath.normpath(path), unicode), + 'normpath() returned str instead of unicode') + def test_expandvars(self): with test_support.EnvironmentVarGuard() as env: env.clear() diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py index 3e8ffa9bdd..0c54d83b82 100644 --- a/Lib/test/test_posixpath.py +++ b/Lib/test/test_posixpath.py @@ -381,6 +381,11 @@ class PosixPathTest(unittest.TestCase): self.assertEqual(posixpath.normpath("///foo/.//bar//.//..//.//baz"), "/foo/baz") self.assertEqual(posixpath.normpath("///..//./foo/.//bar"), "/foo/bar") + # Issue 5827: Make sure normpath preserves unicode + for path in (u'', u'.', u'/', u'\\', u'///foo/.//bar//'): + self.assertTrue(isinstance(posixpath.normpath(path), unicode), + 'normpath() returned str instead of unicode') + self.assertRaises(TypeError, posixpath.normpath) def test_abspath(self): |