MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_optimize_flag

Method test_optimize_flag

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

Source from the content-addressed store, hash-verified

3660 self.check_output(source, expect, flag)
3661
3662 def test_optimize_flag(self):
3663 # test 'python -m ast -O/--optimize 1/2'
3664 source = '''
3665 match a:
3666 case 1+2j:
3667 pass
3668 '''
3669 expect = '''
3670 Module(
3671 body=[
3672 Match(
3673 subject=Name(id='a', ctx=Load()),
3674 cases=[
3675 match_case(
3676 pattern=MatchValue(
3677 value=Constant(value=(1+2j))),
3678 body=[
3679 Pass()])])])
3680 '''
3681 for flag in ('-O=1', '--optimize=1', '-O=2', '--optimize=2'):
3682 with self.subTest(flag=flag):
3683 self.check_output(source, expect, flag)
3684
3685 def test_show_empty_flag(self):
3686 # test 'python -m ast --show-empty'

Callers

nothing calls this directly

Calls 2

check_outputMethod · 0.95
subTestMethod · 0.80

Tested by

no test coverage detected