GH-116377: Stop raising ValueError from glob.translate(). (#116378)

Stop raising `ValueError` from `glob.translate()` when a `**` sub-string
appears in a non-recursive pattern segment. This matches `glob.glob()`
behaviour.
This commit is contained in:
Barney Gale 2024-03-17 17:09:35 +00:00 committed by GitHub
parent 1cf0301086
commit 0634201f53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 26 deletions

View file

@ -512,8 +512,6 @@ class DummyPurePathTest(unittest.TestCase):
self.assertFalse(P('a/b/c.py').full_match('**/a/b/c./**'))
self.assertFalse(P('a/b/c.py').full_match('/a/b/c.py/**'))
self.assertFalse(P('a/b/c.py').full_match('/**/a/b/c.py'))
self.assertRaises(ValueError, P('a').full_match, '**a/b/c')
self.assertRaises(ValueError, P('a').full_match, 'a/b/c**')
# Case-sensitive flag
self.assertFalse(P('A.py').full_match('a.PY', case_sensitive=True))
self.assertTrue(P('A.py').full_match('a.PY', case_sensitive=False))