diff options
author | Georg Brandl <georg@python.org> | 2011-01-09 07:38:51 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-01-09 07:38:51 (GMT) |
commit | 619e7ba8148cb9ebf11a1331c788b6713e88ca5d (patch) | |
tree | 160522c207fc7f9ee88f239c03e7ccf87365fcec /Lib/test/test_ast.py | |
parent | 5b2d9ddf69cecfb9ad4e687fab3f34ecc5a9ea4f (diff) | |
download | cpython-619e7ba8148cb9ebf11a1331c788b6713e88ca5d.zip cpython-619e7ba8148cb9ebf11a1331c788b6713e88ca5d.tar.gz cpython-619e7ba8148cb9ebf11a1331c788b6713e88ca5d.tar.bz2 |
#10869: do not visit root node twice in ast.increment_lineno().
Diffstat (limited to 'Lib/test/test_ast.py')
-rw-r--r-- | Lib/test/test_ast.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index 34456bc..499facd 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -264,6 +264,13 @@ class ASTHelpers_Test(unittest.TestCase): 'op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, ' 'col_offset=0))' ) + # issue10869: do not increment lineno of root twice + self.assertEqual(ast.increment_lineno(src.body, n=3), src.body) + self.assertEqual(ast.dump(src, include_attributes=True), + 'Expression(body=BinOp(left=Num(n=1, lineno=4, col_offset=0), ' + 'op=Add(), right=Num(n=1, lineno=4, col_offset=4), lineno=4, ' + 'col_offset=0))' + ) def test_iter_fields(self): node = ast.parse('foo()', mode='eval') |