MCPcopy Index your code
hub / github.com/python/cpython / test_feature_version_flag

Method test_feature_version_flag

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

Source from the content-addressed store, hash-verified

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'

Callers

nothing calls this directly

Calls 3

check_outputMethod · 0.95
invoke_astMethod · 0.95
assertRaisesMethod · 0.45

Tested by

no test coverage detected