Skip to content

Commit a6e3366

Browse files
committed
Also test that the deprecation warning is emitted in case of constant folding
1 parent 5acbe37 commit a6e3366

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/test_bool.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,15 @@ def test_math(self):
6565
# module loading and not during test execution.
6666
false = False
6767
self.assertEqual(~false, -1)
68+
with self.assertWarns(DeprecationWarning):
69+
# also check that the warning is issued in case of constant
70+
# folding at compile time
71+
self.assertEqual(eval("~False"), -1)
6872
with self.assertWarns(DeprecationWarning):
6973
true = True
7074
self.assertEqual(~true, -2)
75+
with self.assertWarns(DeprecationWarning):
76+
self.assertEqual(eval("~True"), -2)
7177

7278
self.assertEqual(False+2, 2)
7379
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