Skip to content

Commit b94d85b

Browse files
committed
Fix tests
1 parent fd98be8 commit b94d85b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/test/test_bool.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@ def test_math(self):
5959
self.assertEqual(abs(True), 1)
6060
self.assertIsNot(abs(True), True)
6161
with self.assertWarns(DeprecationWarning):
62-
self.assertEqual(~False, -1)
62+
# WE need to put the bool in a variable, because the constant
63+
# ~False is evaluated at compile time due to constant folding;
64+
# consequently the DeprecationWarning would be issued during setup
65+
# and not during test execution
66+
false = False
67+
self.assertEqual(~false, -1)
6368
with self.assertWarns(DeprecationWarning):
64-
self.assertEqual(~True, -2)
69+
true = True
70+
self.assertEqual(~true, -2)
6571

6672
self.assertEqual(False+2, 2)
6773
self.assertEqual(True+2, 3)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy