Lines Matching refs:validate
119 def validate(self, code): member in GrammarTest
124 self.validate(code)
133 self.validate("a @ b")
134 self.validate("a @= b")
139 self.validate("yield from x")
140 self.validate("(yield from x) + y")
146 self.validate("""async def foo():
150 self.validate("""async def foo():
154 self.validate("""async def foo():
160 self.validate("""async def foo():
164 self.validate("""async def foo():
168 self.validate("""async def foo():
177 self.validate("""async def foo(): return await a""")
179 self.validate("""def foo():
195 self.validate("""async = 1""")
196 self.validate("""await = 1""")
197 self.validate("""def async(): pass""")
200 self.validate("""async def foo():
207 self.validate("""async def foo():
216 self.validate("raise")
219 self.validate("raise E, V")
222 self.validate("raise E, V, T")
228 self.validate("raise E1 from E2")
248 self.validate("""func(1, *(2, 3), 4)""")
251 self.validate("""func(**{'eggs':'scrambled', 'spam':'fried'})""")
254 self.validate("""func(spam='fried', **{'eggs':'scrambled'})""")
257 self.validate("""[*{2}, 3, *[4]]""")
260 self.validate("""{*{2}, 3, *[4]}""")
263 self.validate("""{**{}}""")
266 self.validate("""{**{}, 3:4, **{5:6, 7:8}}""")
269 self.validate("""f(a, *b, *c, d)""")
272 self.validate("""f(**a, **b)""")
275 self.validate("""f(2, *a, *b, **b, **c, **d)""")
278 self.validate("def f(a, b): call(a, b)")
279 self.validate("def f(a, b,): call(a, b,)")
282 self.validate("def f(a, *b): call(a, *b)")
283 self.validate("def f(a, *b,): call(a, *b,)")
286 self.validate("def f(a, b=1): call(a, b=1)")
287 self.validate("def f(a, b=1,): call(a, b=1,)")
290 self.validate("def f(a, **b): call(a, **b)")
291 self.validate("def f(a, **b,): call(a, **b,)")
294 self.validate("def f(*a, b=1): call(*a, b=1)")
295 self.validate("def f(*a, b=1,): call(*a, b=1,)")
298 self.validate("def f(*a, **b): call(*a, **b)")
299 self.validate("def f(*a, **b,): call(*a, **b,)")
302 self.validate("def f(*, b=1): call(*b)")
303 self.validate("def f(*, b=1,): call(*b,)")
306 self.validate("def f(a=1, b=2): call(a=1, b=2)")
307 self.validate("def f(a=1, b=2,): call(a=1, b=2,)")
310 self.validate("def f(a=1, **b): call(a=1, **b)")
311 self.validate("def f(a=1, **b,): call(a=1, **b,)")
314 self.validate("f = lambda a, b: call(a, b)")
315 self.validate("f = lambda a, b,: call(a, b,)")
318 self.validate("f = lambda a, *b: call(a, *b)")
319 self.validate("f = lambda a, *b,: call(a, *b,)")
322 self.validate("f = lambda a, b=1: call(a, b=1)")
323 self.validate("f = lambda a, b=1,: call(a, b=1,)")
326 self.validate("f = lambda a, **b: call(a, **b)")
327 self.validate("f = lambda a, **b,: call(a, **b,)")
330 self.validate("f = lambda *a, b=1: call(*a, b=1)")
331 self.validate("f = lambda *a, b=1,: call(*a, b=1,)")
334 self.validate("f = lambda *a, **b: call(*a, **b)")
335 self.validate("f = lambda *a, **b,: call(*a, **b,)")
338 self.validate("f = lambda *, b=1: call(*b)")
339 self.validate("f = lambda *, b=1,: call(*b,)")
342 self.validate("f = lambda a=1, b=2: call(a=1, b=2)")
343 self.validate("f = lambda a=1, b=2,: call(a=1, b=2,)")
346 self.validate("f = lambda a=1, **b: call(a=1, **b)")
347 self.validate("f = lambda a=1, **b,: call(a=1, **b,)")
353 self.validate("""def f(x) -> list: pass""")
356 self.validate("""def f(x:int): pass""")
359 self.validate("""def f(*x:str): pass""")
362 self.validate("""def f(**x:float): pass""")
365 self.validate("""def f(x, y:1+2): pass""")
368 self.validate("""def f(a, (b:1, c:2, d)): pass""")
371 self.validate("""def f(a, (b:1, c:2, d), e:3=4, f=5, *g:6): pass""")
376 self.validate(s)
387 self.validate(s)
394 self.validate(s)
401 self.validate(s)
408 self.validate(s)
411 self.validate("def f(a: str, b: int) -> None: call(a, b)")
412 self.validate("def f(a: str, b: int,) -> None: call(a, b,)")
415 self.validate("def f(a: str, *b: int) -> None: call(a, *b)")
416 self.validate("def f(a: str, *b: int,) -> None: call(a, *b,)")
419 self.validate("def f(a: str, b: int=1) -> None: call(a, b=1)")
420 self.validate("def f(a: str, b: int=1,) -> None: call(a, b=1,)")
423 self.validate("def f(a: str, **b: int) -> None: call(a, **b)")
424 self.validate("def f(a: str, **b: int,) -> None: call(a, **b,)")
427 self.validate("def f(*a: str, b: int=1) -> None: call(*a, b=1)")
428 self.validate("def f(*a: str, b: int=1,) -> None: call(*a, b=1,)")
431 self.validate("def f(*a: str, **b: int) -> None: call(*a, **b)")
432 self.validate("def f(*a: str, **b: int,) -> None: call(*a, **b,)")
435 self.validate("def f(*, b: int=1) -> None: call(*b)")
436 self.validate("def f(*, b: int=1,) -> None: call(*b,)")
439 self.validate("def f(a: str='', b: int=2) -> None: call(a=a, b=2)")
440 self.validate("def f(a: str='', b: int=2,) -> None: call(a=a, b=2,)")
443 self.validate("def f(a: str='', **b: int) -> None: call(a=a, **b)")
444 self.validate("def f(a: str='', **b: int,) -> None: call(a=a, **b,)")
450 self.validate("var1: int = 5")
453 self.validate("var2: [int, str]")
456 self.validate("def f():\n"
462 self.validate("def fbad():\n"
467 self.validate("class C:\n"
475 self.validate("lst: List[int] = []")
485 self.validate(s)
493 self.validate(s)
512 self.validate(single)
514 self.validate(triple)
520 self.validate("""x = {'one'}""")
523 self.validate("""x = {'one', 1,}""")
526 self.validate("""x = {'one', 'two', 'three'}""")
529 self.validate("""x = {2, 3, 4,}""")
536 self.validate("Örter = 'places'\ngrün = 'green'")
537 self.validate("蟒 = a蟒 = 锦蛇 = 1")
538 self.validate("µ = aµ = µµ = 1")
539 self.validate(" = a_ = 1")
544 self.validate("""0o7777777777777""")
548 self.validate("""0b101010""")
554 self.validate("class B(t=7): pass")
555 self.validate("class B(t, *args): pass")
556 self.validate("class B(t, **kwargs): pass")
557 self.validate("class B(t, *args, **kwargs): pass")
558 self.validate("class B(t, y=9, *args, **kwargs,): pass")
594 def validate(self, s): member in TestLiterals
604 self.validate(s)
613 self.validate(s)
622 self.validate(s)