summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-07 08:31:51 +0000
committerGeorg Brandl <georg@python.org>2007-03-07 08:31:51 +0000
commit71ff64674375b355c9449f8b511b49756d880e48 (patch)
tree5e38f0cbe2602c4fe59a935e830ef432ee51c785 /Lib/test
parent172e7257f65e5d37974aacf0c467e76a321ddf2c (diff)
downloadcpython-git-71ff64674375b355c9449f8b511b49756d880e48.tar.gz
Patch #1001604: glob.glob() now returns unicode filenames if it was
given a unicode argument and os.listdir() returns unicode filenames.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_glob.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index 5ce09f9d10..f1993aba31 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -52,6 +52,16 @@ class GlobTests(unittest.TestCase):
eq(self.glob('aab'), [self.norm('aab')])
eq(self.glob('zymurgy'), [])
+ # test return types are unicode, but only if os.listdir
+ # returns unicode filenames
+ uniset = set([unicode])
+ tmp = os.listdir(u'.')
+ if set(type(x) for x in tmp) == uniset:
+ u1 = glob.glob(u'*')
+ u2 = glob.glob(u'./*')
+ self.assertEquals(set(type(r) for r in u1), uniset)
+ self.assertEquals(set(type(r) for r in u2), uniset)
+
def test_glob_one_directory(self):
eq = self.assertSequencesEqual_noorder
eq(self.glob('a*'), map(self.norm, ['a', 'aab', 'aaa']))