summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_long.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-05-12 20:35:40 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-05-12 20:35:40 (GMT)
commit7fe1049fcbb623609c79c8f9ecc8e5ffc7cf6439 (patch)
tree087a9db3028b85c510b510e71dba591f0d0ec447 /Lib/test/test_long.py
parentbf88ffba5edf780e12a64db9cb929216c19f6cfa (diff)
downloadcpython-7fe1049fcbb623609c79c8f9ecc8e5ffc7cf6439.zip
cpython-7fe1049fcbb623609c79c8f9ecc8e5ffc7cf6439.tar.gz
cpython-7fe1049fcbb623609c79c8f9ecc8e5ffc7cf6439.tar.bz2
Issue #21422: Add a test to check that bool << int and bool >> int return an int
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r--Lib/test/test_long.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py
index 13152ec..5f14795 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)