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