diff options
| author | andrei kulakov <andrei.avk@gmail.com> | 2023-05-03 03:50:10 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-03 03:50:10 (GMT) |
| commit | af886ffa0612124598b5e8174c3b1be0f60eab38 (patch) | |
| tree | e3e79405cb875e87b8cd5ce7574c0cbcd41748ca /Lib/test/test_pathlib.py | |
| parent | c7c3a60c88de61a79ded9fdaf6bc6a29da4efb9a (diff) | |
| download | cpython-af886ffa0612124598b5e8174c3b1be0f60eab38.zip cpython-af886ffa0612124598b5e8174c3b1be0f60eab38.tar.gz cpython-af886ffa0612124598b5e8174c3b1be0f60eab38.tar.bz2 | |
GH-89769: `pathlib.Path.glob()`: do not follow symlinks when checking for precise match (GH-29655)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Diffstat (limited to 'Lib/test/test_pathlib.py')
| -rw-r--r-- | Lib/test/test_pathlib.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 9902b72..620d480 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1700,6 +1700,8 @@ class _BasePathTest(object): self.assertIs(True, (p / 'linkB').exists()) self.assertIs(True, (p / 'linkB' / 'fileB').exists()) self.assertIs(False, (p / 'linkA' / 'bah').exists()) + self.assertIs(False, (p / 'brokenLink').exists()) + self.assertIs(True, (p / 'brokenLink').exists(follow_symlinks=False)) self.assertIs(False, (p / 'foo').exists()) self.assertIs(False, P('/xyzzy').exists()) self.assertIs(False, P(BASE + '\udfff').exists()) @@ -1806,6 +1808,8 @@ class _BasePathTest(object): _check(p.glob("*/fileB"), ['dirB/fileB']) else: _check(p.glob("*/fileB"), ['dirB/fileB', 'linkB/fileB']) + if os_helper.can_symlink(): + _check(p.glob("brokenLink"), ['brokenLink']) if not os_helper.can_symlink(): _check(p.glob("*/"), ["dirA", "dirB", "dirC", "dirE"]) |
