diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2022-11-06 15:36:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 15:36:19 (GMT) |
commit | 61b6c40b645bd8c8568f1646dc46580fa49d107a (patch) | |
tree | 8b7a53cc5aefabbf59ba9cd78c4a07c409e0fd9f /Lib/test/test_syntax.py | |
parent | d3b82b4463c4eb51954c0afd98342f0c5e479baa (diff) | |
download | cpython-61b6c40b645bd8c8568f1646dc46580fa49d107a.zip cpython-61b6c40b645bd8c8568f1646dc46580fa49d107a.tar.gz cpython-61b6c40b645bd8c8568f1646dc46580fa49d107a.tar.bz2 |
gh-99153: set location on SyntaxError for try with both except and except* (GH-99160)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r-- | Lib/test/test_syntax.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index b822bc9..7253842 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -2014,6 +2014,16 @@ class SyntaxTestCase(unittest.TestCase): "Generator expression must be parenthesized", lineno=1, end_lineno=1, offset=11, end_offset=53) + def test_except_then_except_star(self): + self._check_error("try: pass\nexcept ValueError: pass\nexcept* TypeError: pass", + r"cannot have both 'except' and 'except\*' on the same 'try'", + lineno=1, end_lineno=1, offset=1, end_offset=4) + + def test_except_star_then_except(self): + self._check_error("try: pass\nexcept* ValueError: pass\nexcept TypeError: pass", + r"cannot have both 'except' and 'except\*' on the same 'try'", + lineno=1, end_lineno=1, offset=1, end_offset=4) + def test_empty_line_after_linecont(self): # See issue-40847 s = r"""\ |