bpo-31202: Preserve case of literal parts in Path.glob() on Windows. … · python/cpython@175abcc · GitHub
Skip to content

Commit 175abcc

Browse files
bpo-31202: Preserve case of literal parts in Path.glob() on Windows. (GH-16860)
(cherry picked from commit 10ecbad) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 3dec84f commit 175abcc

3 files changed

Lines changed: 26 additions & 18 deletions

File tree

Lib/pathlib.py

Lines changed: 20 additions & 18 deletions

Lib/test/test_pathlib.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,11 +2216,15 @@ def test_glob(self):
22162216
P = self.cls
22172217
p = P(BASE)
22182218
self.assertEqual(set(p.glob("FILEa")), { P(BASE, "fileA") })
2219+
self.assertEqual(set(p.glob("F*a")), { P(BASE, "fileA") })
2220+
self.assertEqual(set(map(str, p.glob("FILEa"))), {f"{p}\\FILEa"})
2221+
self.assertEqual(set(map(str, p.glob("F*a"))), {f"{p}\\fileA"})
22192222

22202223
def test_rglob(self):
22212224
P = self.cls
22222225
p = P(BASE, "dirC")
22232226
self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") })
2227+
self.assertEqual(set(map(str, p.rglob("FILEd"))), {f"{p}\\dirD\\FILEd"})
22242228

22252229
def test_expanduser(self):
22262230
P = self.cls
Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)