diff options
| author | Victor Stinner <vstinner@python.org> | 2020-04-23 03:03:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-23 03:03:24 +0200 |
| commit | 1def7754b7a41fe57efafaf5eff24cfa15353444 (patch) | |
| tree | 8fd9f9ddeaf9a66f92d1916b86901573afce0ccb /Lib/test/test_positional_only_arg.py | |
| parent | a25f3c4c8f7d4878918ce1d3d67db40ae255ccc6 (diff) | |
| download | cpython-git-1def7754b7a41fe57efafaf5eff24cfa15353444.tar.gz | |
bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)
* Rename PyConfig.use_peg to _use_peg_parser
* Document PyConfig._use_peg_parser and mark it a deprecated
* Mark -X oldparser option and PYTHONOLDPARSER env var as deprecated
in the documentation.
* Add use_old_parser() and skip_if_new_parser() to test.support
* Remove sys.flags.use_peg: use_old_parser() uses
_testinternalcapi.get_configs() instead.
* Enhance test_embed tests
* subprocess._args_from_interpreter_flags() copies -X oldparser
Diffstat (limited to 'Lib/test/test_positional_only_arg.py')
| -rw-r--r-- | Lib/test/test_positional_only_arg.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_positional_only_arg.py b/Lib/test/test_positional_only_arg.py index 332690051e..4d5fb6bc61 100644 --- a/Lib/test/test_positional_only_arg.py +++ b/Lib/test/test_positional_only_arg.py @@ -5,7 +5,7 @@ import pickle import unittest import sys -from test.support import check_syntax_error +from test.support import check_syntax_error, use_old_parser def global_pos_only_f(a, b, /): @@ -24,7 +24,7 @@ class PositionalOnlyTestCase(unittest.TestCase): compile(codestr + "\n", "<test>", "single") def test_invalid_syntax_errors(self): - if not sys.flags.use_peg: + if use_old_parser(): check_syntax_error(self, "def f(a, b = 5, /, c): pass", "non-default argument follows default argument") check_syntax_error(self, "def f(a = 5, b, /, c): pass", "non-default argument follows default argument") check_syntax_error(self, "def f(a = 5, b=1, /, c, *, d=2): pass", "non-default argument follows default argument") @@ -47,7 +47,7 @@ class PositionalOnlyTestCase(unittest.TestCase): check_syntax_error(self, "def f(a, *, c, /, d, e): pass") def test_invalid_syntax_errors_async(self): - if not sys.flags.use_peg: + if use_old_parser(): check_syntax_error(self, "async def f(a, b = 5, /, c): pass", "non-default argument follows default argument") check_syntax_error(self, "async def f(a = 5, b, /, c): pass", "non-default argument follows default argument") check_syntax_error(self, "async def f(a = 5, b=1, /, c, d=2): pass", "non-default argument follows default argument") @@ -236,7 +236,7 @@ class PositionalOnlyTestCase(unittest.TestCase): self.assertEqual(x(1, 2), 3) def test_invalid_syntax_lambda(self): - if not sys.flags.use_peg: + if use_old_parser(): check_syntax_error(self, "lambda a, b = 5, /, c: None", "non-default argument follows default argument") check_syntax_error(self, "lambda a = 5, b, /, c: None", "non-default argument follows default argument") check_syntax_error(self, "lambda a = 5, b, /: None", "non-default argument follows default argument") |
