[Python-checkins] GH-89812: Test that `pathlib.Path.is_junction()` returns false (GH-106062)

barneygale webhook-mailer at python.org
Sat Jul 1 07:58:34 EDT 2023


https://github.com/python/cpython/commit/6e01055e15c252185b118956d545bfad03ae11ed
commit: 6e01055e15c252185b118956d545bfad03ae11ed
branch: main
author: Barney Gale <barney.gale at gmail.com>
committer: barneygale <barney.gale at gmail.com>
date: 2023-07-01T12:58:30+01:00
summary:

GH-89812: Test that `pathlib.Path.is_junction()` returns false (GH-106062)

Slightly expand the test coverage of `is_junction()`. The existing test
only checks that `os.path.isjunction()` is called under-the-hood.

files:
M Lib/test/test_pathlib.py

diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index a87f6c4cdc3da..441a7bcd4d419 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -2271,6 +2271,15 @@ def test_is_symlink(self):
             self.assertIs((P / 'linkA\udfff').is_file(), False)
             self.assertIs((P / 'linkA\x00').is_file(), False)
 
+    def test_is_junction_false(self):
+        P = self.cls(BASE)
+        self.assertFalse((P / 'fileA').is_junction())
+        self.assertFalse((P / 'dirA').is_junction())
+        self.assertFalse((P / 'non-existing').is_junction())
+        self.assertFalse((P / 'fileA' / 'bah').is_junction())
+        self.assertFalse((P / 'fileA\udfff').is_junction())
+        self.assertFalse((P / 'fileA\x00').is_junction())
+
     def test_is_fifo_false(self):
         P = self.cls(BASE)
         self.assertFalse((P / 'fileA').is_fifo())



More information about the Python-checkins mailing list