Kaydet (Commit) 7fe1049f authored tarafından Victor Stinner's avatar Victor Stinner

Issue #21422: Add a test to check that bool << int and bool >> int return an int

üst bf88ffba
...@@ -1235,6 +1235,13 @@ class LongTest(unittest.TestCase): ...@@ -1235,6 +1235,13 @@ class LongTest(unittest.TestCase):
for n in map(int, integers): for n in map(int, integers):
self.assertEqual(n, 0) self.assertEqual(n, 0)
def test_shift_bool(self):
# Issue #21422: ensure that bool << int and bool >> int return int
for value in (True, False):
for shift in (0, 2):
self.assertEqual(type(value << shift), int)
self.assertEqual(type(value >> shift), int)
def test_main(): def test_main():
support.run_unittest(LongTest) support.run_unittest(LongTest)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment