]> granicus.if.org Git - python/commitdiff
Issue #21422: Add a test to check that bool << int and bool >> int return an int
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 12 May 2014 20:35:40 +0000 (22:35 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 12 May 2014 20:35:40 +0000 (22:35 +0200)
Lib/test/test_long.py

index 13152ecf129439bb1dfbd0e9774041f1768e91ee..5f14795649a1e72c3eca4cc0c16b213425f8d272 100644 (file)
@@ -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)