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

Method test_no_optimize_flag

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

Source from the content-addressed store, hash-verified

3634 self.invoke_ast('--feature-version=3.9')
3635
3636 def test_no_optimize_flag(self):
3637 # test 'python -m ast -O/--optimize -1/0'
3638 source = '''
3639 match a:
3640 case 1+2j:
3641 pass
3642 '''
3643 expect = '''
3644 Module(
3645 body=[
3646 Match(
3647 subject=Name(id='a', ctx=Load()),
3648 cases=[
3649 match_case(
3650 pattern=MatchValue(
3651 value=BinOp(
3652 left=Constant(value=1),
3653 op=Add(),
3654 right=Constant(value=2j))),
3655 body=[
3656 Pass()])])])
3657 '''
3658 for flag in ('-O=-1', '--optimize=-1', '-O=0', '--optimize=0'):
3659 with self.subTest(flag=flag):
3660 self.check_output(source, expect, flag)
3661
3662 def test_optimize_flag(self):
3663 # test 'python -m ast -O/--optimize 1/2'

Callers

nothing calls this directly

Calls 2

check_outputMethod · 0.95
subTestMethod · 0.80

Tested by

no test coverage detected