#3426: os.path.abspath now returns unicode when its arg is unicode.

This commit is contained in:
Ezio Melotti 2010-02-20 08:09:39 +00:00
parent 61afd2694b
commit 4cc80ca921
8 changed files with 57 additions and 6 deletions

View file

@ -8,6 +8,16 @@ class MacPathTestCase(unittest.TestCase):
def test_abspath(self):
self.assertTrue(macpath.abspath("xx:yy") == "xx:yy")
# Issue 3426: check that abspath retuns unicode when the arg is unicode
# and str when it's str, with both ASCII and non-ASCII cwds
for cwd in (u'cwd', u'\xe7w\xf0'):
with test_support.temp_cwd(cwd):
for path in ('', 'foo', 'f\xf2\xf2', '/foo', 'C:\\'):
self.assertIsInstance(macpath.abspath(path), str)
for upath in (u'', u'fuu', u'f\xf9\xf9', u'/fuu', u'U:\\'):
self.assertIsInstance(macpath.abspath(upath), unicode)
def test_isabs(self):
isabs = macpath.isabs
self.assertTrue(isabs("xx:yy"))