Commit Graph

6 Commits

Author SHA1 Message Date
Mark Dickinson d751c2eafc test_unparse.py: Do roundtrip testing for all Python files in Lib and Lib/test. 2010-06-29 14:08:23 +00:00
Mark Dickinson 8042e28192 More unparse.py fixes:
- parenthesize lambdas, to avoid turning (lambda : int)() into lambda: int()
 - unparse an infinite float literals in the AST as an overflowing finite value

unparse.py now successfully round-trips on all valid Lib/*.py and Lib/test/*.py files.
2010-06-29 10:01:48 +00:00
Mark Dickinson 3eb0290346 Add parentheses around numeric literals, to avoid turning 3 .bit_length() into 3.bit_length(). 2010-06-29 08:52:36 +00:00
Mark Dickinson fa2e4e9d04 Update Demo/parser/unparse.py to current Python 3.x syntax. Additions:
- relative imports
 - keyword-only arguments
 - function annotations
 - class decorators
 - raise ... from ...
 - except ... as ...
 - nonlocal
 - bytes literals
 - set literals
 - set comprehensions
 - dict comprehensions
Removals:
 - print statement.

Some of this should be backported to 2.x.
2010-06-28 21:14:17 +00:00
Mark Dickinson f5451e546a Merged revisions 82345 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82345 | mark.dickinson | 2010-06-28 20:54:19 +0100 (Mon, 28 Jun 2010) | 1 line

  unparse.py:  fix mispaced parentheses in chained comparisons
........
2010-06-28 20:09:18 +00:00
Mark Dickinson ae1000533a Merged revisions 82338,82340-82341 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r82338 | mark.dickinson | 2010-06-28 20:31:41 +0100 (Mon, 28 Jun 2010) | 9 lines

  Fix some shallow bugs in Demo/parser/unparse.py, and add tests:

    - insert commas between entries in del statement
    - left and right shifts were represented as >> and << (respectively); reverse
    - unindent properly after for: else:  or while: else:
    - add parens around the result of an unary operation
    - add parens around negative numbers, to avoid turning (-1)**2 into -1**2.
........
  r82340 | mark.dickinson | 2010-06-28 20:34:15 +0100 (Mon, 28 Jun 2010) | 1 line

  Fix typo in test_unparse.py.
........
  r82341 | mark.dickinson | 2010-06-28 20:38:19 +0100 (Mon, 28 Jun 2010) | 1 line

  Set svn:eol-style on test_unparse.py.
........
2010-06-28 19:44:20 +00:00