We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fd98be8 commit 20dec73Copy full SHA for 20dec73
Lib/test/test_bool.py
@@ -59,9 +59,15 @@ def test_math(self):
59
self.assertEqual(abs(True), 1)
60
self.assertIsNot(abs(True), True)
61
with self.assertWarns(DeprecationWarning):
62
- self.assertEqual(~False, -1)
+ # 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
65
+ # module loading and not during test execution.
66
+ false = False
67
+ self.assertEqual(~false, -1)
68
- self.assertEqual(~True, -2)
69
+ true = True
70
+ self.assertEqual(~true, -2)
71
72
self.assertEqual(False+2, 2)
73
self.assertEqual(True+2, 3)
0 commit comments