diff options
author | Lysandros Nikolaou <lisandrosnik@gmail.com> | 2021-01-03 01:14:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-03 01:14:21 +0200 |
commit | 2ea320dddd553298038bb7d6789e50e199332f66 (patch) | |
tree | e0388038b94c848cc18922f86ff0cb82e4c44465 /Lib/test | |
parent | No need to test "istep==1" twice. (GH-24064) (diff) | |
download | cpython-2ea320dddd553298038bb7d6789e50e199332f66.tar.gz cpython-2ea320dddd553298038bb7d6789e50e199332f66.tar.bz2 cpython-2ea320dddd553298038bb7d6789e50e199332f66.zip |
bpo-40631: Disallow single parenthesized star target (GH-24027)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_unpack_ex.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py index fcc93829cc3..049e48b13fa 100644 --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -346,6 +346,31 @@ Now some general starred expressions (all fail). ... SyntaxError: can't use starred expression here + >>> (*x),y = 1, 2 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + + >>> (((*x))),y = 1, 2 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + + >>> z,(*x),y = 1, 2, 4 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + + >>> z,(*x) = 1, 2 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + + >>> ((*x),y) = 1, 2 # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + SyntaxError: can't use starred expression here + Some size constraints (all fail.) >>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range(1<<8 + 1)" |