diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-02-05 20:51:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-05 20:51:11 (GMT) |
commit | 652fbf88c4c422ff17fefd4dcb5e06b5c0e26e74 (patch) | |
tree | 61b36dd4f458619c68bbee592bade7ed18993dda /Lib/test/test_genericpath.py | |
parent | 09096a1647913526a3d4fa69a9d2056ec82a8f37 (diff) | |
download | cpython-652fbf88c4c422ff17fefd4dcb5e06b5c0e26e74.zip cpython-652fbf88c4c422ff17fefd4dcb5e06b5c0e26e74.tar.gz cpython-652fbf88c4c422ff17fefd4dcb5e06b5c0e26e74.tar.bz2 |
gh-82626: Emit a warning when bool is used as a file descriptor (GH-111275)
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r-- | Lib/test/test_genericpath.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py index b77cd4c..f407ee3 100644 --- a/Lib/test/test_genericpath.py +++ b/Lib/test/test_genericpath.py @@ -165,6 +165,12 @@ class GenericTest: os.close(w) self.assertFalse(self.pathmodule.exists(r)) + def test_exists_bool(self): + for fd in False, True: + with self.assertWarnsRegex(RuntimeWarning, + 'bool is used as a file descriptor'): + self.pathmodule.exists(fd) + def test_isdir(self): filename = os_helper.TESTFN bfilename = os.fsencode(filename) |