MCPcopy Index your code
hub / github.com/python/cpython / test_invocation

Method test_invocation

Lib/test/test_ast/test_ast.py:3448–3470  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3446
3447 @support.requires_resource('cpu')
3448 def test_invocation(self):
3449 # test various combinations of parameters
3450 base_flags = (
3451 ('-m=exec', '--mode=exec'),
3452 ('--no-type-comments', '--no-type-comments'),
3453 ('-a', '--include-attributes'),
3454 ('-i=4', '--indent=4'),
3455 ('--feature-version=3.13', '--feature-version=3.13'),
3456 ('-O=-1', '--optimize=-1'),
3457 ('--show-empty', '--show-empty'),
3458 )
3459 self.set_source('''
3460 print(1, 2, 3)
3461 def f(x: int) -> int:
3462 x -= 1
3463 return x
3464 ''')
3465
3466 for r in range(1, len(base_flags) + 1):
3467 for choices in itertools.combinations(base_flags, r=r):
3468 for args in itertools.product(*choices):
3469 with self.subTest(flags=args):
3470 self.invoke_ast(*args)
3471
3472 @support.force_not_colorized
3473 def test_help_message(self):

Callers

nothing calls this directly

Calls 3

set_sourceMethod · 0.95
invoke_astMethod · 0.95
subTestMethod · 0.45

Tested by

no test coverage detected