@@ -270,10 +270,7 @@ def test_ast_line_numbers_duplicate_expression(self):
270270 self .assertEqual (binop .right .col_offset , 7 ) # FIXME: this is wrong
271271
272272 def test_ast_line_numbers_multiline_fstring (self ):
273- # FIXME: This test demonstrates invalid behavior due to JoinedStr's
274- # immediate child nodes containing the wrong lineno. The enclosed
275- # expressions have valid line information and column offsets.
276- # See bpo-16806 and bpo-30465 for details.
273+ # See bpo-30465 for details.
277274 expr = """
278275a = 10
279276f'''
@@ -298,19 +295,16 @@ def test_ast_line_numbers_multiline_fstring(self):
298295 self .assertEqual (type (t .body [1 ].value .values [1 ]), ast .FormattedValue )
299296 self .assertEqual (type (t .body [1 ].value .values [2 ]), ast .Constant )
300297 self .assertEqual (type (t .body [1 ].value .values [2 ].value ), str )
301- # NOTE: the following invalid behavior is described in bpo-16806.
302- # - line number should be the *first* line (3), not the *last* (8)
303- # - column offset should not be -1
304- self .assertEqual (t .body [1 ].lineno , 8 )
305- self .assertEqual (t .body [1 ].value .lineno , 8 )
306- self .assertEqual (t .body [1 ].value .values [0 ].lineno , 8 )
307- self .assertEqual (t .body [1 ].value .values [1 ].lineno , 8 )
308- self .assertEqual (t .body [1 ].value .values [2 ].lineno , 8 )
309- self .assertEqual (t .body [1 ].col_offset , - 1 )
310- self .assertEqual (t .body [1 ].value .col_offset , - 1 )
311- self .assertEqual (t .body [1 ].value .values [0 ].col_offset , - 1 )
312- self .assertEqual (t .body [1 ].value .values [1 ].col_offset , - 1 )
313- self .assertEqual (t .body [1 ].value .values [2 ].col_offset , - 1 )
298+ self .assertEqual (t .body [1 ].lineno , 3 )
299+ self .assertEqual (t .body [1 ].value .lineno , 3 )
300+ self .assertEqual (t .body [1 ].value .values [0 ].lineno , 3 )
301+ self .assertEqual (t .body [1 ].value .values [1 ].lineno , 3 )
302+ self .assertEqual (t .body [1 ].value .values [2 ].lineno , 3 )
303+ self .assertEqual (t .body [1 ].col_offset , 0 )
304+ self .assertEqual (t .body [1 ].value .col_offset , 0 )
305+ self .assertEqual (t .body [1 ].value .values [0 ].col_offset , 0 )
306+ self .assertEqual (t .body [1 ].value .values [1 ].col_offset , 0 )
307+ self .assertEqual (t .body [1 ].value .values [2 ].col_offset , 0 )
314308 # NOTE: the following lineno information and col_offset is correct for
315309 # expressions within FormattedValues.
316310 binop = t .body [1 ].value .values [1 ].value
@@ -321,8 +315,8 @@ def test_ast_line_numbers_multiline_fstring(self):
321315 self .assertEqual (binop .lineno , 4 )
322316 self .assertEqual (binop .left .lineno , 4 )
323317 self .assertEqual (binop .right .lineno , 6 )
324- self .assertEqual (binop .col_offset , 3 )
325- self .assertEqual (binop .left .col_offset , 3 )
318+ self .assertEqual (binop .col_offset , 4 )
319+ self .assertEqual (binop .left .col_offset , 4 )
326320 self .assertEqual (binop .right .col_offset , 7 )
327321
328322 def test_docstring (self ):
0 commit comments