summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fstring.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_fstring.py')
-rw-r--r--Lib/test/test_fstring.py32
1 files changed, 13 insertions, 19 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 9e45770..9d60be3 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -270,10 +270,7 @@ f'{a * x()} {a * x()} {a * x()}'
self.assertEqual(binop.right.col_offset, 7) # FIXME: this is wrong
def test_ast_line_numbers_multiline_fstring(self):
- # FIXME: This test demonstrates invalid behavior due to JoinedStr's
- # immediate child nodes containing the wrong lineno. The enclosed
- # expressions have valid line information and column offsets.
- # See bpo-16806 and bpo-30465 for details.
+ # See bpo-30465 for details.
expr = """
a = 10
f'''
@@ -298,19 +295,16 @@ non-important content
self.assertEqual(type(t.body[1].value.values[1]), ast.FormattedValue)
self.assertEqual(type(t.body[1].value.values[2]), ast.Constant)
self.assertEqual(type(t.body[1].value.values[2].value), str)
- # NOTE: the following invalid behavior is described in bpo-16806.
- # - line number should be the *first* line (3), not the *last* (8)
- # - column offset should not be -1
- self.assertEqual(t.body[1].lineno, 8)
- self.assertEqual(t.body[1].value.lineno, 8)
- self.assertEqual(t.body[1].value.values[0].lineno, 8)
- self.assertEqual(t.body[1].value.values[1].lineno, 8)
- self.assertEqual(t.body[1].value.values[2].lineno, 8)
- self.assertEqual(t.body[1].col_offset, -1)
- self.assertEqual(t.body[1].value.col_offset, -1)
- self.assertEqual(t.body[1].value.values[0].col_offset, -1)
- self.assertEqual(t.body[1].value.values[1].col_offset, -1)
- self.assertEqual(t.body[1].value.values[2].col_offset, -1)
+ self.assertEqual(t.body[1].lineno, 3)
+ self.assertEqual(t.body[1].value.lineno, 3)
+ self.assertEqual(t.body[1].value.values[0].lineno, 3)
+ self.assertEqual(t.body[1].value.values[1].lineno, 3)
+ self.assertEqual(t.body[1].value.values[2].lineno, 3)
+ self.assertEqual(t.body[1].col_offset, 0)
+ self.assertEqual(t.body[1].value.col_offset, 0)
+ self.assertEqual(t.body[1].value.values[0].col_offset, 0)
+ self.assertEqual(t.body[1].value.values[1].col_offset, 0)
+ self.assertEqual(t.body[1].value.values[2].col_offset, 0)
# NOTE: the following lineno information and col_offset is correct for
# expressions within FormattedValues.
binop = t.body[1].value.values[1].value
@@ -321,8 +315,8 @@ non-important content
self.assertEqual(binop.lineno, 4)
self.assertEqual(binop.left.lineno, 4)
self.assertEqual(binop.right.lineno, 6)
- self.assertEqual(binop.col_offset, 3)
- self.assertEqual(binop.left.col_offset, 3)
+ self.assertEqual(binop.col_offset, 4)
+ self.assertEqual(binop.left.col_offset, 4)
self.assertEqual(binop.right.col_offset, 7)
def test_docstring(self):