summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/pathlib/_abc.py2
-rw-r--r--Lib/test/test_pathlib/test_pathlib.py2
-rw-r--r--Lib/test/test_pathlib/test_pathlib_abc.py7
3 files changed, 6 insertions, 5 deletions
diff --git a/Lib/pathlib/_abc.py b/Lib/pathlib/_abc.py
index 6303a18..ad56848 100644
--- a/Lib/pathlib/_abc.py
+++ b/Lib/pathlib/_abc.py
@@ -771,7 +771,7 @@ class PathBase(PurePathBase):
filter_paths = False
deduplicate_paths = False
sep = self.pathmod.sep
- paths = iter([self.joinpath('')] if self.is_dir() else [])
+ paths = iter([self] if self.is_dir() else [])
while stack:
part = stack.pop()
if part in specials:
diff --git a/Lib/test/test_pathlib/test_pathlib.py b/Lib/test/test_pathlib/test_pathlib.py
index 9c2b26d..5ce3b60 100644
--- a/Lib/test/test_pathlib/test_pathlib.py
+++ b/Lib/test/test_pathlib/test_pathlib.py
@@ -1232,6 +1232,8 @@ class PathTest(test_pathlib_abc.DummyPathTest, PurePathTest):
list(p.glob(''))
with self.assertRaisesRegex(ValueError, 'Unacceptable pattern'):
list(p.glob('.'))
+ with self.assertRaisesRegex(ValueError, 'Unacceptable pattern'):
+ list(p.glob('./'))
def test_glob_many_open_files(self):
depth = 30
diff --git a/Lib/test/test_pathlib/test_pathlib_abc.py b/Lib/test/test_pathlib/test_pathlib_abc.py
index ea70931..ab989cb 100644
--- a/Lib/test/test_pathlib/test_pathlib_abc.py
+++ b/Lib/test/test_pathlib/test_pathlib_abc.py
@@ -1733,12 +1733,11 @@ class DummyPathTest(DummyPurePathTest):
self.assertEqual(set(map(str, p.glob("F*a"))), {f"{p}\\fileA"})
def test_glob_empty_pattern(self):
- def _check(glob, expected):
- self.assertEqual(set(glob), { P(self.base, q) for q in expected })
P = self.cls
p = P(self.base)
- _check(p.glob(""), [""])
- _check(p.glob("."), ["."])
+ self.assertEqual(list(p.glob("")), [p])
+ self.assertEqual(list(p.glob(".")), [p / "."])
+ self.assertEqual(list(p.glob("./")), [p / "./"])
def test_glob_case_sensitive(self):
P = self.cls