]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-94808: Add coverage for boolobject.c:bool_new (GH-94859) (GH-94883)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 15 Jul 2022 17:37:13 +0000 (10:37 -0700)
committerGitHub <noreply@github.com>
Fri, 15 Jul 2022 17:37:13 +0000 (10:37 -0700)
`bool_new` had no coverage.

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

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
Co-authored-by: Michael Droettboom <mdboom@gmail.com>
Lib/test/test_bool.py

index 4b32aad2419f4a567a898a4c120def43a4b4cccd..f46f21da8da35178f40221befb46567ec5919d15 100644 (file)
@@ -369,6 +369,13 @@ class BoolTest(unittest.TestCase):
         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()