Skip to content

Commit 93c3092

Browse files
committed
Add some more matching tests for glob tests.
1 parent e5abc80 commit 93c3092

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Lib/test/test_glob.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,12 @@ def test_translate_matching(self):
458458
self.assertIsNone(match(os.path.join('foo', '.bar.txt')))
459459
match = re.compile(glob.translate('foo[%-0]bar', recursive=True)).match
460460
self.assertIsNone(match(os.path.join('foo', 'bar')))
461+
match = re.compile(glob.translate('foo?bar', recursive=True)).match
462+
self.assertIsNone(match('foo/bar'))
463+
match = re.compile(glob.translate('foo.', recursive=True)).match
464+
self.assertIsNone(match('foo/'))
465+
match = re.compile(glob.translate('foo*', recursive=True)).match
466+
self.assertIsNone(match('foo/'))
461467

462468
def test_translate(self):
463469
def fn(pat):

Misc/NEWS.d/next/Library/2025-03-08-23-26-50.gh-issue-130942.jxRMK_.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
lookahead (``(?!/)``) or by not including the path separator (``^/``). In addition,
55
ranges including path separator literals are now correctly escaped, as specified by
66
POSIX specifications.
7-
87
.. versionchanged:: next
98
:func:`fnmatch.translate` does not treat path separator characters as having any
109
special meaning at all, so it still matches ranges implicitly containing path

0 commit comments

Comments
 (0)