mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Merged revisions 87876-87877 via svnmerge from
svn+ssh://pythondev@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. ........
This commit is contained in:
parent
cec4b4fa04
commit
6adb97939b
5 changed files with 18 additions and 8 deletions
|
@ -264,6 +264,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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue