Merged revisions 77442 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77442 | ezio.melotti | 2010-01-12 05:32:05 +0200 (Tue, 12 Jan 2010) | 1 line

  #5827: make sure that normpath preserves unicode
........
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index a077c78..10bbe3a 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -123,6 +123,11 @@
         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):
         oldenv = os.environ.copy()
         try:
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index b7fbd50..f6cb047 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -385,6 +385,11 @@
         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):