[Python-checkins] gh-94808: Add coverage for boolobject.c:bool_new (GH-94859) (GH-94883)

brandtbucher webhook-mailer at python.org
Fri Jul 15 13:37:20 EDT 2022


https://github.com/python/cpython/commit/8dc4de3aafed9aceaa904206f757f11bb682999b
commit: 8dc4de3aafed9aceaa904206f757f11bb682999b
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: brandtbucher <brandtbucher at gmail.com>
date: 2022-07-15T10:37:13-07:00
summary:

gh-94808: Add coverage for boolobject.c:bool_new (GH-94859) (GH-94883)

`bool_new` had no coverage.

Automerge-Triggered-By: GH:brandtbucher
(cherry picked from commit df4d53a09ab9fd9116d1b52bdc42133e019ca82b)

Co-authored-by: Michael Droettboom <mdboom at gmail.com>

Co-authored-by: Michael Droettboom <mdboom at gmail.com>

files:
M Lib/test/test_bool.py

diff --git a/Lib/test/test_bool.py b/Lib/test/test_bool.py
index 4b32aad2419f4..f46f21da8da35 100644
--- a/Lib/test/test_bool.py
+++ b/Lib/test/test_bool.py
@@ -369,6 +369,13 @@ def f(x):
         f(x)
         self.assertGreaterEqual(x.count, 1)
 
+    def test_bool_new(self):
+        self.assertIs(bool.__new__(bool), False)
+        self.assertIs(bool.__new__(bool, 1), True)
+        self.assertIs(bool.__new__(bool, 0), False)
+        self.assertIs(bool.__new__(bool, False), False)
+        self.assertIs(bool.__new__(bool, True), True)
+
 
 if __name__ == "__main__":
     unittest.main()



More information about the Python-checkins mailing list