mirror of
https://github.com/python/cpython.git
synced 2025-09-02 15:07:53 +00:00
Issue #14697: Merge fix from 3.2.
This commit is contained in:
commit
72f6095d4f
3 changed files with 104 additions and 20 deletions
|
@ -309,6 +309,29 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
|||
"except Exception as e:\n"
|
||||
" raise ValueError from e\n")
|
||||
|
||||
def test_set_displays(self):
|
||||
self.check_expr('{2}')
|
||||
self.check_expr('{2,}')
|
||||
self.check_expr('{2, 3}')
|
||||
self.check_expr('{2, 3,}')
|
||||
|
||||
def test_dict_displays(self):
|
||||
self.check_expr('{}')
|
||||
self.check_expr('{a:b}')
|
||||
self.check_expr('{a:b,}')
|
||||
self.check_expr('{a:b, c:d}')
|
||||
self.check_expr('{a:b, c:d,}')
|
||||
|
||||
def test_set_comprehensions(self):
|
||||
self.check_expr('{x for x in seq}')
|
||||
self.check_expr('{f(x) for x in seq}')
|
||||
self.check_expr('{f(x) for x in seq if condition(x)}')
|
||||
|
||||
def test_dict_comprehensions(self):
|
||||
self.check_expr('{x:x for x in seq}')
|
||||
self.check_expr('{x**2:x[3] for x in seq if condition(x)}')
|
||||
self.check_expr('{x:x for x in seq1 for y in seq2 if condition(x, y)}')
|
||||
|
||||
|
||||
#
|
||||
# Second, we take *invalid* trees and make sure we get ParserError
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue