summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-01-09 07:55:46 (GMT)
committerGeorg Brandl <georg@python.org>2011-01-09 07:55:46 (GMT)
commit7fdc746a81a29a5f917fb41500b03c92adf40851 (patch)
tree4fcfdeda32dbf260b44ac4e0c486674c6191774e /Lib/test
parent389af0037175ec5327d401b3d4a3b13d509cc926 (diff)
downloadcpython-7fdc746a81a29a5f917fb41500b03c92adf40851.zip
cpython-7fdc746a81a29a5f917fb41500b03c92adf40851.tar.gz
cpython-7fdc746a81a29a5f917fb41500b03c92adf40851.tar.bz2
Merged revisions 87876-87877 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r87876 | georg.brandl | 2011-01-09 08:38:51 +0100 (So, 09 Jan 2011) | 1 line #10869: do not visit root node twice in ast.increment_lineno(). ........ r87877 | georg.brandl | 2011-01-09 08:50:48 +0100 (So, 09 Jan 2011) | 1 line Add missing line. ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_ast.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py
index c74a30d..de19c8a 100644
--- a/Lib/test/test_ast.py
+++ b/Lib/test/test_ast.py
@@ -253,6 +253,14 @@ 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
+ src = ast.parse('1 + 1', mode='eval')
+ 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')