aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r--Lib/test/test_pathlib.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 4391d685d3c..076ace3d930 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -310,8 +310,30 @@ class _BasePurePathTest(object):
self.assertFalse(P('/ab.py').match('/a/*.py'))
self.assertFalse(P('/a/b/c.py').match('/a/*.py'))
# Multi-part glob-style pattern.
- self.assertFalse(P('/a/b/c.py').match('/**/*.py'))
+ self.assertTrue(P('a').match('**'))
+ self.assertTrue(P('c.py').match('**'))
+ self.assertTrue(P('a/b/c.py').match('**'))
+ self.assertTrue(P('/a/b/c.py').match('**'))
+ self.assertTrue(P('/a/b/c.py').match('/**'))
+ self.assertTrue(P('/a/b/c.py').match('**/'))
+ self.assertTrue(P('/a/b/c.py').match('/a/**'))
+ self.assertTrue(P('/a/b/c.py').match('**/*.py'))
+ self.assertTrue(P('/a/b/c.py').match('/**/*.py'))
self.assertTrue(P('/a/b/c.py').match('/a/**/*.py'))
+ self.assertTrue(P('/a/b/c.py').match('/a/b/**/*.py'))
+ self.assertTrue(P('/a/b/c.py').match('/**/**/**/**/*.py'))
+ self.assertFalse(P('c.py').match('**/a.py'))
+ self.assertFalse(P('c.py').match('c/**'))
+ self.assertFalse(P('a/b/c.py').match('**/a'))
+ self.assertFalse(P('a/b/c.py').match('**/a/b'))
+ self.assertFalse(P('a/b/c.py').match('**/a/b/c'))
+ self.assertFalse(P('a/b/c.py').match('**/a/b/c.'))
+ self.assertFalse(P('a/b/c.py').match('**/a/b/c./**'))
+ self.assertFalse(P('a/b/c.py').match('**/a/b/c./**'))
+ self.assertFalse(P('a/b/c.py').match('/a/b/c.py/**'))
+ self.assertFalse(P('a/b/c.py').match('/**/a/b/c.py'))
+ self.assertRaises(ValueError, P('a').match, '**a/b/c')
+ self.assertRaises(ValueError, P('a').match, 'a/b/c**')
# Case-sensitive flag
self.assertFalse(P('A.py').match('a.PY', case_sensitive=True))
self.assertTrue(P('A.py').match('a.PY', case_sensitive=False))