]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-102252: Improve coverage of test_bool.py (GH-102253)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 25 Feb 2023 21:15:45 +0000 (13:15 -0800)
committerGitHub <noreply@github.com>
Sat, 25 Feb 2023 21:15:45 +0000 (13:15 -0800)
Add tests for conversion from bool to complex.
(cherry picked from commit 41970436373f4be813fe8f5a07b6da04d5f4c80e)

Co-authored-by: Eclips4 <80244920+Eclips4@users.noreply.github.com>
Lib/test/test_bool.py

index f46f21da8da35178f40221befb46567ec5919d15..b711ffb9a3ecd53d65405a8000c88435ec8fa1df 100644 (file)
@@ -40,6 +40,12 @@ class BoolTest(unittest.TestCase):
         self.assertEqual(float(True), 1.0)
         self.assertIsNot(float(True), True)
 
+    def test_complex(self):
+        self.assertEqual(complex(False), 0j)
+        self.assertEqual(complex(False), False)
+        self.assertEqual(complex(True), 1+0j)
+        self.assertEqual(complex(True), True)
+
     def test_math(self):
         self.assertEqual(+False, 0)
         self.assertIsNot(+False, False)