Lines Matching refs:check_expr
29 def check_expr(self, s): member in RoundtripLegalSyntaxTestCase
94 self.check_expr("foo(1)")
95 self.check_expr("[1, 2, 3]")
96 self.check_expr("[x**3 for x in range(20)]")
97 self.check_expr("[x**3 for x in range(20) if x % 3]")
98 self.check_expr("[x**3 for x in range(20) if x % 2 if x % 3]")
99 self.check_expr("list(x**3 for x in range(20))")
100 self.check_expr("list(x**3 for x in range(20) if x % 3)")
101 self.check_expr("list(x**3 for x in range(20) if x % 2 if x % 3)")
102 self.check_expr("foo(*args)")
103 self.check_expr("foo(*args, **kw)")
104 self.check_expr("foo(**kw)")
105 self.check_expr("foo(key=value)")
106 self.check_expr("foo(key=value, *args)")
107 self.check_expr("foo(key=value, *args, **kw)")
108 self.check_expr("foo(key=value, **kw)")
109 self.check_expr("foo(a, b, c, *args)")
110 self.check_expr("foo(a, b, c, *args, **kw)")
111 self.check_expr("foo(a, b, c, **kw)")
112 self.check_expr("foo(a, *args, keyword=23)")
113 self.check_expr("foo + bar")
114 self.check_expr("foo - bar")
115 self.check_expr("foo * bar")
116 self.check_expr("foo / bar")
117 self.check_expr("foo // bar")
118 self.check_expr("lambda: 0")
119 self.check_expr("lambda x: 0")
120 self.check_expr("lambda *y: 0")
121 self.check_expr("lambda *y, **z: 0")
122 self.check_expr("lambda **z: 0")
123 self.check_expr("lambda x, y: 0")
124 self.check_expr("lambda foo=bar: 0")
125 self.check_expr("lambda foo=bar, spaz=nifty+spit: 0")
126 self.check_expr("lambda foo=bar, **z: 0")
127 self.check_expr("lambda foo=bar, blaz=blat+2, **z: 0")
128 self.check_expr("lambda foo=bar, blaz=blat+2, *y, **z: 0")
129 self.check_expr("lambda x, *y, **z: 0")
130 self.check_expr("(x for x in range(10))")
131 self.check_expr("foo(x for x in range(10))")
132 self.check_expr("...")
133 self.check_expr("a[...]")
388 self.check_expr('[]')
389 self.check_expr('[*{2}, 3, *[4]]')
392 self.check_expr('{*{2}, 3, *[4]}')
393 self.check_expr('{2}')
394 self.check_expr('{2,}')
395 self.check_expr('{2, 3}')
396 self.check_expr('{2, 3,}')
399 self.check_expr('{}')
400 self.check_expr('{a:b}')
401 self.check_expr('{a:b,}')
402 self.check_expr('{a:b, c:d}')
403 self.check_expr('{a:b, c:d,}')
404 self.check_expr('{**{}}')
405 self.check_expr('{**{}, 3:4, **{5:6, 7:8}}')
408 self.check_expr("f(*a, **b)")
409 self.check_expr('f(a, *b, *c, *d)')
410 self.check_expr('f(**a, **b)')
411 self.check_expr('f(2, *a, *b, **b, **c, **d)')
412 self.check_expr("f(*b, *() or () and (), **{} and {}, **() or {})")
415 self.check_expr('{x for x in seq}')
416 self.check_expr('{f(x) for x in seq}')
417 self.check_expr('{f(x) for x in seq if condition(x)}')
420 self.check_expr('{x:x for x in seq}')
421 self.check_expr('{x**2:x[3] for x in seq if condition(x)}')
422 self.check_expr('{x:x for x in seq1 for y in seq2 if condition(x, y)}')