(self)
| 3584 | self.check_output(source, expect, flag) |
| 3585 | |
| 3586 | def test_feature_version_flag(self): |
| 3587 | # test 'python -m ast --feature-version 3.9/3.10' |
| 3588 | source = ''' |
| 3589 | match x: |
| 3590 | case 1: |
| 3591 | pass |
| 3592 | ''' |
| 3593 | expect = ''' |
| 3594 | Module( |
| 3595 | body=[ |
| 3596 | Match( |
| 3597 | subject=Name(id='x'), |
| 3598 | cases=[ |
| 3599 | match_case( |
| 3600 | pattern=MatchValue( |
| 3601 | value=Constant(value=1)), |
| 3602 | body=[ |
| 3603 | Pass()])])]) |
| 3604 | ''' |
| 3605 | self.check_output(source, expect, '--feature-version=3.10') |
| 3606 | with self.assertRaises(SyntaxError): |
| 3607 | self.invoke_ast('--feature-version=3.9') |
| 3608 | |
| 3609 | def test_no_optimize_flag(self): |
| 3610 | # test 'python -m ast -O/--optimize -1/0' |
nothing calls this directly
no test coverage detected