From 7fe1049fcbb623609c79c8f9ecc8e5ffc7cf6439 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 12 May 2014 22:35:40 +0200 Subject: [PATCH] Issue #21422: Add a test to check that bool << int and bool >> int return an int --- Lib/test/test_long.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index 13152ecf129..5f14795649a 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -1235,6 +1235,13 @@ class LongTest(unittest.TestCase): for n in map(int, integers): 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(): support.run_unittest(LongTest)