summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_glob.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-11-09 21:12:07 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-11-09 21:12:07 (GMT)
commit735b790fed417c797d68d031c75a005a5e6dfc52 (patch)
tree694e2ffdeba0ceafda4d7e4da39c486bc1d71ad4 /Lib/test/test_glob.py
parentf9827ea61859c6fb3fdac1e5a364d87bd4237622 (diff)
downloadcpython-735b790fed417c797d68d031c75a005a5e6dfc52.zip
cpython-735b790fed417c797d68d031c75a005a5e6dfc52.tar.gz
cpython-735b790fed417c797d68d031c75a005a5e6dfc52.tar.bz2
Issue #25584: Fixed recursive glob() with patterns starting with '**'.
Diffstat (limited to 'Lib/test/test_glob.py')
-rw-r--r--Lib/test/test_glob.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index 926588e..dce64f9 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -31,6 +31,7 @@ class GlobTests(unittest.TestCase):
self.mktemp('.bb', 'H')
self.mktemp('aaa', 'zzzF')
self.mktemp('ZZZ')
+ self.mktemp('EF')
self.mktemp('a', 'bcd', 'EF')
self.mktemp('a', 'bcd', 'efg', 'ha')
if can_symlink():
@@ -200,7 +201,7 @@ class GlobTests(unittest.TestCase):
def test_recursive_glob(self):
eq = self.assertSequencesEqual_noorder
- full = [('ZZZ',),
+ full = [('EF',), ('ZZZ',),
('a',), ('a', 'D'),
('a', 'bcd'),
('a', 'bcd', 'EF'),
@@ -217,8 +218,8 @@ class GlobTests(unittest.TestCase):
('sym3', 'efg', 'ha'),
]
eq(self.rglob('**'), self.joins(('',), *full))
- eq(self.rglob('.', '**'), self.joins(('.',''),
- *(('.',) + i for i in full)))
+ eq(self.rglob(os.curdir, '**'),
+ self.joins((os.curdir, ''), *((os.curdir,) + i for i in full)))
dirs = [('a', ''), ('a', 'bcd', ''), ('a', 'bcd', 'efg', ''),
('aaa', ''), ('aab', '')]
if can_symlink():
@@ -229,11 +230,11 @@ class GlobTests(unittest.TestCase):
('a', ''), ('a', 'D'), ('a', 'bcd'), ('a', 'bcd', 'EF'),
('a', 'bcd', 'efg'), ('a', 'bcd', 'efg', 'ha')))
eq(self.rglob('a**'), self.joins(('a',), ('aaa',), ('aab',)))
- expect = [('a', 'bcd', 'EF')]
+ expect = [('a', 'bcd', 'EF'), ('EF',)]
if can_symlink():
expect += [('sym3', 'EF')]
eq(self.rglob('**', 'EF'), self.joins(*expect))
- expect = [('a', 'bcd', 'EF'), ('aaa', 'zzzF'), ('aab', 'F')]
+ expect = [('a', 'bcd', 'EF'), ('aaa', 'zzzF'), ('aab', 'F'), ('EF',)]
if can_symlink():
expect += [('sym3', 'EF')]
eq(self.rglob('**', '*F'), self.joins(*expect))
@@ -247,10 +248,18 @@ class GlobTests(unittest.TestCase):
eq(glob.glob('**', recursive=True), [join(*i) for i in full])
eq(glob.glob(join('**', ''), recursive=True),
[join(*i) for i in dirs])
+ eq(glob.glob(join('**', '*'), recursive=True),
+ [join(*i) for i in full])
+ eq(glob.glob(join(os.curdir, '**'), recursive=True),
+ [join(os.curdir, '')] + [join(os.curdir, *i) for i in full])
+ eq(glob.glob(join(os.curdir, '**', ''), recursive=True),
+ [join(os.curdir, '')] + [join(os.curdir, *i) for i in dirs])
+ eq(glob.glob(join(os.curdir, '**', '*'), recursive=True),
+ [join(os.curdir, *i) for i in full])
eq(glob.glob(join('**','zz*F'), recursive=True),
[join('aaa', 'zzzF')])
eq(glob.glob('**zz*F', recursive=True), [])
- expect = [join('a', 'bcd', 'EF')]
+ expect = [join('a', 'bcd', 'EF'), 'EF']
if can_symlink():
expect += [join('sym3', 'EF')]
eq(glob.glob(join('**', 'EF'), recursive=True), expect)