summaryrefslogtreecommitdiffstats
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.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 3412d84..0d0c2f1 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1662,6 +1662,11 @@ class _BasePathTest(object):
else:
_check(p.glob("*/fileB"), ['dirB/fileB', 'linkB/fileB'])
+ if not os_helper.can_symlink():
+ _check(p.glob("*/"), ["dirA", "dirB", "dirC", "dirE"])
+ else:
+ _check(p.glob("*/"), ["dirA", "dirB", "dirC", "dirE", "linkB"])
+
def test_rglob_common(self):
def _check(glob, expected):
self.assertEqual(set(glob), { P(BASE, q) for q in expected })
@@ -1679,6 +1684,16 @@ class _BasePathTest(object):
"linkB/fileB", "dirA/linkC/fileB"])
_check(p.rglob("file*"), ["fileA", "dirB/fileB",
"dirC/fileC", "dirC/dirD/fileD"])
+ if not os_helper.can_symlink():
+ _check(p.rglob("*/"), [
+ "dirA", "dirB", "dirC", "dirC/dirD", "dirE",
+ ])
+ else:
+ _check(p.rglob("*/"), [
+ "dirA", "dirA/linkC", "dirB", "dirB/linkD", "dirC",
+ "dirC/dirD", "dirE", "linkB",
+ ])
+
p = P(BASE, "dirC")
_check(p.rglob("file*"), ["dirC/fileC", "dirC/dirD/fileD"])
_check(p.rglob("*/*"), ["dirC/dirD/fileD"])
@@ -2682,6 +2697,7 @@ class WindowsPathTest(_BasePathTest, unittest.TestCase):
P = self.cls
p = P(BASE)
self.assertEqual(set(p.glob("FILEa")), { P(BASE, "fileA") })
+ self.assertEqual(set(p.glob("*a\\")), { P(BASE, "dirA") })
self.assertEqual(set(p.glob("F*a")), { P(BASE, "fileA") })
self.assertEqual(set(map(str, p.glob("FILEa"))), {f"{p}\\FILEa"})
self.assertEqual(set(map(str, p.glob("F*a"))), {f"{p}\\fileA"})
@@ -2690,6 +2706,7 @@ class WindowsPathTest(_BasePathTest, unittest.TestCase):
P = self.cls
p = P(BASE, "dirC")
self.assertEqual(set(p.rglob("FILEd")), { P(BASE, "dirC/dirD/fileD") })
+ self.assertEqual(set(p.rglob("*\\")), { P(BASE, "dirC/dirD") })
self.assertEqual(set(map(str, p.rglob("FILEd"))), {f"{p}\\dirD\\FILEd"})
def test_expanduser(self):