Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66113bb

Browse files
committed
(Merge 3.4) Issue #21422: Add a test to check that bool << int and bool >> int
return an int
2 parents 5fb195f + 7fe1049 commit 66113bb

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/test/test_long.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,13 @@ def __new__(cls, value=0):
12351235
for n in map(int, integers):
12361236
self.assertEqual(n, 0)
12371237

1238+
def test_shift_bool(self):
1239+
# Issue #21422: ensure that bool << int and bool >> int return int
1240+
for value in (True, False):
1241+
for shift in (0, 2):
1242+
self.assertEqual(type(value << shift), int)
1243+
self.assertEqual(type(value >> shift), int)
1244+
12381245

12391246
def test_main():
12401247
support.run_unittest(LongTest)

0 commit comments

Comments
 (0)