summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-06-18 23:10:43 (GMT)
committerGitHub <noreply@github.com>2020-06-18 23:10:43 (GMT)
commit01ece63d42b830df106948db0aefa6c1ba24416a (patch)
tree0bb2f932d4604c12507dd79b12b06d4dafc46e8b /Lib/test/test_exceptions.py
parentd906f0ec1a5f4ec29a4de74240acf43139886514 (diff)
downloadcpython-01ece63d42b830df106948db0aefa6c1ba24416a.zip
cpython-01ece63d42b830df106948db0aefa6c1ba24416a.tar.gz
cpython-01ece63d42b830df106948db0aefa6c1ba24416a.tar.bz2
bpo-40334: Produce better error messages on invalid targets (GH-20106)
The following error messages get produced: - `cannot delete ...` for invalid `del` targets - `... is an illegal 'for' target` for invalid targets in for statements - `... is an illegal 'with' target` for invalid targets in with statements Additionally, a few `cut`s were added in various places before the invocation of the `invalid_*` rule, in order to speed things up. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r--Lib/test/test_exceptions.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index feae31b..a67e69b 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -251,9 +251,9 @@ class ExceptionTests(unittest.TestCase):
check('def f():\n x, y: int', 2, 3)
check('[*x for x in xs]', 1, 2)
check('foo(x for x in range(10), 100)', 1, 5)
+ check('for 1 in []: pass', 1, 5)
check('(yield i) = 2', 1, 2)
check('def f(*):\n pass', 1, 8)
- check('for 1 in []: pass', 1, 7)
@cpython_only
def testSettingException(self):