(self)
| 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' |
nothing calls this directly
no test coverage detected