summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_syntax.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2022-11-06 15:36:19 (GMT)
committerGitHub <noreply@github.com>2022-11-06 15:36:19 (GMT)
commit61b6c40b645bd8c8568f1646dc46580fa49d107a (patch)
tree8b7a53cc5aefabbf59ba9cd78c4a07c409e0fd9f /Lib/test/test_syntax.py
parentd3b82b4463c4eb51954c0afd98342f0c5e479baa (diff)
downloadcpython-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.py10
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"""\