8000 Also test that the deprecation warning is emitted in case of constant… · python/cpython@a6e3366 · GitHub
[go: up one dir, main page]

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)
0