Lines Matching refs:check_src_roundtrip
138 def check_src_roundtrip(self, code1, code2=None): member in ASTTestCase
365 self.check_src_roundtrip(ast.Constant(value=(1,), kind=None), "(1,)")
366 self.check_src_roundtrip(
414 self.check_src_roundtrip("(a := b)")
415 self.check_src_roundtrip("await x")
416 self.check_src_roundtrip("x if x else y")
417 self.check_src_roundtrip("lambda x: x")
418 self.check_src_roundtrip("1 + 1")
419 self.check_src_roundtrip("1 + 2 / 3")
420 self.check_src_roundtrip("(1 + 2) / 3")
421 self.check_src_roundtrip("(1 + 2) * 3 + 4 * (5 + 2)")
422 self.check_src_roundtrip("(1 + 2) * 3 + 4 * (5 + 2) ** 2")
423 self.check_src_roundtrip("~x")
424 self.check_src_roundtrip("x and y")
425 self.check_src_roundtrip("x and y and z")
426 self.check_src_roundtrip("x and (y and x)")
427 self.check_src_roundtrip("(x and y) and z")
428 self.check_src_roundtrip("(x ** y) ** z ** q")
429 self.check_src_roundtrip("x >> y")
430 self.check_src_roundtrip("x << y")
431 self.check_src_roundtrip("x >> y and x >> z")
432 self.check_src_roundtrip("x + y - z * q ^ t ** k")
433 self.check_src_roundtrip("P * V if P and V else n * R * T")
434 self.check_src_roundtrip("lambda P, V, n: P * V == n * R * T")
435 self.check_src_roundtrip("flag & (other | foo)")
436 self.check_src_roundtrip("not x == y")
437 self.check_src_roundtrip("x == (not y)")
438 self.check_src_roundtrip("yield x")
439 self.check_src_roundtrip("yield from x")
440 self.check_src_roundtrip("call((yield x))")
441 self.check_src_roundtrip("return x + (yield x)")
444 self.check_src_roundtrip("class X:\n pass")
445 self.check_src_roundtrip("class X(A):\n pass")
446 self.check_src_roundtrip("class X(A, B, C, D):\n pass")
447 self.check_src_roundtrip("class X(x=y):\n pass")
448 self.check_src_roundtrip("class X(metaclass=z):\n pass")
449 self.check_src_roundtrip("class X(x=y, z=d):\n pass")
450 self.check_src_roundtrip("class X(A, x=y):\n pass")
451 self.check_src_roundtrip("class X(A, **kw):\n pass")
452 self.check_src_roundtrip("class X(*args):\n pass")
453 self.check_src_roundtrip("class X(*args, **kwargs):\n pass")
456 self.check_src_roundtrip('''f\'\'\'-{f"""*{f"+{f'.{x}.'}+"}*"""}-\'\'\'''')
457 self.check_src_roundtrip('''f"\\u2028{'x'}"''')
458 self.check_src_roundtrip(r"f'{x}\n'")
459 self.check_src_roundtrip('''f''\'{"""\n"""}\\n''\'''')
460 self.check_src_roundtrip('''f''\'{f"""{x}\n"""}\\n''\'''')
484 self.check_src_roundtrip(f"{prefix}{docstring}")
506 self.check_src_roundtrip(f"{prefix}1")
508 self.check_src_roundtrip(f"{prefix} 1")
511 self.check_src_roundtrip("a[1]")
512 self.check_src_roundtrip("a[1, 2]")
513 self.check_src_roundtrip("a[(1, *a)]")