Lines Matching refs:check_expr
34 def check_expr(self, s): member in RoundtripLegalSyntaxTestCase
99 self.check_expr("foo(1)")
100 self.check_expr("[1, 2, 3]")
101 self.check_expr("[x**3 for x in range(20)]")
102 self.check_expr("[x**3 for x in range(20) if x % 3]")
103 self.check_expr("[x**3 for x in range(20) if x % 2 if x % 3]")
104 self.check_expr("list(x**3 for x in range(20))")
105 self.check_expr("list(x**3 for x in range(20) if x % 3)")
106 self.check_expr("list(x**3 for x in range(20) if x % 2 if x % 3)")
107 self.check_expr("foo(*args)")
108 self.check_expr("foo(*args, **kw)")
109 self.check_expr("foo(**kw)")
110 self.check_expr("foo(key=value)")
111 self.check_expr("foo(key=value, *args)")
112 self.check_expr("foo(key=value, *args, **kw)")
113 self.check_expr("foo(key=value, **kw)")
114 self.check_expr("foo(a, b, c, *args)")
115 self.check_expr("foo(a, b, c, *args, **kw)")
116 self.check_expr("foo(a, b, c, **kw)")
117 self.check_expr("foo(a, *args, keyword=23)")
118 self.check_expr("foo + bar")
119 self.check_expr("foo - bar")
120 self.check_expr("foo * bar")
121 self.check_expr("foo / bar")
122 self.check_expr("foo // bar")
123 self.check_expr("(foo := 1)")
124 self.check_expr("lambda: 0")
125 self.check_expr("lambda x: 0")
126 self.check_expr("lambda *y: 0")
127 self.check_expr("lambda *y, **z: 0")
128 self.check_expr("lambda **z: 0")
129 self.check_expr("lambda x, y: 0")
130 self.check_expr("lambda foo=bar: 0")
131 self.check_expr("lambda foo=bar, spaz=nifty+spit: 0")
132 self.check_expr("lambda foo=bar, **z: 0")
133 self.check_expr("lambda foo=bar, blaz=blat+2, **z: 0")
134 self.check_expr("lambda foo=bar, blaz=blat+2, *y, **z: 0")
135 self.check_expr("lambda x, *y, **z: 0")
136 self.check_expr("(x for x in range(10))")
137 self.check_expr("foo(x for x in range(10))")
138 self.check_expr("...")
139 self.check_expr("a[...]")
452 self.check_expr('[]')
453 self.check_expr('[*{2}, 3, *[4]]')
456 self.check_expr('{*{2}, 3, *[4]}')
457 self.check_expr('{2}')
458 self.check_expr('{2,}')
459 self.check_expr('{2, 3}')
460 self.check_expr('{2, 3,}')
463 self.check_expr('{}')
464 self.check_expr('{a:b}')
465 self.check_expr('{a:b,}')
466 self.check_expr('{a:b, c:d}')
467 self.check_expr('{a:b, c:d,}')
468 self.check_expr('{**{}}')
469 self.check_expr('{**{}, 3:4, **{5:6, 7:8}}')
472 self.check_expr("f(*a, **b)")
473 self.check_expr('f(a, *b, *c, *d)')
474 self.check_expr('f(**a, **b)')
475 self.check_expr('f(2, *a, *b, **b, **c, **d)')
476 self.check_expr("f(*b, *() or () and (), **{} and {}, **() or {})")
479 self.check_expr('{x for x in seq}')
480 self.check_expr('{f(x) for x in seq}')
481 self.check_expr('{f(x) for x in seq if condition(x)}')
484 self.check_expr('{x:x for x in seq}')
485 self.check_expr('{x**2:x[3] for x in seq if condition(x)}')
486 self.check_expr('{x:x for x in seq1 for y in seq2 if condition(x, y)}')