@@ -1207,6 +1207,32 @@ def test_multiline_expression(self):
1207
1207
self .assertOpcodeSourcePositionIs (compiled_code , 'CALL' ,
1208
1208
line = 1 , end_line = 3 , column = 0 , end_column = 1 )
1209
1209
1210
+ def test_multiline_boolean_expression (self ):
1211
+ snippet = """\
1212
+ if (a or
1213
+ (b and not c) or
1214
+ not (
1215
+ d > 0)):
1216
+ x = 42
1217
+ """
1218
+
1219
+ compiled_code , _ = self .check_positions_against_ast (snippet )
1220
+ # jump if a is true:
1221
+ self .assertOpcodeSourcePositionIs (compiled_code , 'POP_JUMP_IF_TRUE' ,
1222
+ line = 1 , end_line = 1 , column = 4 , end_column = 5 , occurrence = 1 )
1223
+ # jump if b is false:
1224
+ self .assertOpcodeSourcePositionIs (compiled_code , 'POP_JUMP_IF_FALSE' ,
1225
+ line = 2 , end_line = 2 , column = 5 , end_column = 6 , occurrence = 1 )
1226
+ # jump if c is false:
1227
+ self .assertOpcodeSourcePositionIs (compiled_code , 'POP_JUMP_IF_FALSE' ,
1228
+ line = 2 , end_line = 2 , column = 15 , end_column = 16 , occurrence = 2 )
1229
+ # compare d and 0
1230
+ self .assertOpcodeSourcePositionIs (compiled_code , 'COMPARE_OP' ,
1231
+ line = 4 , end_line = 4 , column = 8 , end_column = 13 , occurrence = 1 )
1232
+ # jump if comparison it True
1233
+ self .assertOpcodeSourcePositionIs (compiled_code , 'POP_JUMP_IF_TRUE' ,
1234
+ line = 4 , end_line = 4 , column = 8 , end_column = 13 , occurrence = 2 )
1235
+
1210
1236
def test_very_long_line_end_offset (self ):
1211
1237
# Make sure we get the correct column offset for offsets
1212
1238
# too large to store in a byte.
0 commit comments