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

Method test_exec_mode_flag

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

Source from the content-addressed store, hash-verified

3480 self.assertStartsWith(output.getvalue(), 'usage: ')
3481
3482 def test_exec_mode_flag(self):
3483 # test 'python -m ast -m/--mode exec'
3484 source = 'x: bool = 1 # type: ignore[assignment]'
3485 expect = '''
3486 Module(
3487 body=[
3488 AnnAssign(
3489 target=Name(id='x', ctx=Store()),
3490 annotation=Name(id='bool'),
3491 value=Constant(value=1),
3492 simple=1)],
3493 type_ignores=[
3494 TypeIgnore(lineno=1, tag='[assignment]')])
3495 '''
3496 for flag in ('-m=exec', '--mode=exec'):
3497 with self.subTest(flag=flag):
3498 self.check_output(source, expect, flag)
3499
3500 def test_single_mode_flag(self):
3501 # test 'python -m ast -m/--mode single'

Callers

nothing calls this directly

Calls 2

check_outputMethod · 0.95
subTestMethod · 0.45

Tested by

no test coverage detected