mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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.
This commit is contained in:
parent
3eb0290346
commit
8042e28192
2 changed files with 26 additions and 11 deletions
|
@ -87,6 +87,13 @@ class UnparseTestCase(unittest.TestCase):
|
|||
def test_integer_parens(self):
|
||||
self.check_roundtrip("3 .__abs__()")
|
||||
|
||||
def test_huge_float(self):
|
||||
self.check_roundtrip("1e1000")
|
||||
self.check_roundtrip("-1e1000")
|
||||
|
||||
def test_lambda_parentheses(self):
|
||||
self.check_roundtrip("(lambda: int)()")
|
||||
|
||||
def test_chained_comparisons(self):
|
||||
self.check_roundtrip("1 < 4 <= 5")
|
||||
self.check_roundtrip("a is b is c is not d")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue