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

Method test_optimize_flag

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

Source from the content-addressed store, hash-verified

3633 self.check_output(source, expect, flag)
3634
3635 def test_optimize_flag(self):
3636 # test 'python -m ast -O/--optimize 1/2'
3637 source = '''
3638 match a:
3639 case 1+2j:
3640 pass
3641 '''
3642 expect = '''
3643 Module(
3644 body=[
3645 Match(
3646 subject=Name(id='a'),
3647 cases=[
3648 match_case(
3649 pattern=MatchValue(
3650 value=Constant(value=(1+2j))),
3651 body=[
3652 Pass()])])])
3653 '''
3654 for flag in ('-O=1', '--optimize=1', '-O=2', '--optimize=2'):
3655 with self.subTest(flag=flag):
3656 self.check_output(source, expect, flag)
3657
3658 def test_show_empty_flag(self):
3659 # test 'python -m ast --show-empty'

Callers

nothing calls this directly

Calls 2

check_outputMethod · 0.95
subTestMethod · 0.45

Tested by

no test coverage detected