Issue #23076: Path.glob() now raises a ValueError if it's called with an

invalid pattern.

Patch by Thomas Nyberg.
This commit is contained in:
Berker Peksag 2016-01-30 17:50:48 +02:00
parent ef410770a7
commit 4a208e448e
4 changed files with 11 additions and 0 deletions

View file

@ -1969,6 +1969,11 @@ class PathTest(_BasePathTest, unittest.TestCase):
else:
self.assertRaises(NotImplementedError, pathlib.WindowsPath)
def test_glob_empty_pattern(self):
p = self.cls()
with self.assertRaisesRegex(ValueError, 'Unacceptable pattern'):
list(p.glob(''))
@only_posix
class PosixPathTest(_BasePathTest, unittest.TestCase):