diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2016-05-18 05:44:29 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2016-05-18 05:44:29 (GMT) |
commit | 094c9c921cc889f1aac99bbcc26b70b19f8ef1d9 (patch) | |
tree | b1b277a2de09a9d534a9bebc1d5b563b7dc54258 /Lib/test/test_unpack.py | |
parent | 93d22ecc7c7e2d3413bb21e0264a293f7884caee (diff) | |
download | cpython-094c9c921cc889f1aac99bbcc26b70b19f8ef1d9.zip cpython-094c9c921cc889f1aac99bbcc26b70b19f8ef1d9.tar.gz cpython-094c9c921cc889f1aac99bbcc26b70b19f8ef1d9.tar.bz2 |
Issue #23275: Allow () = iterable assignment syntax
Documentation updates by Martin Panter.
Diffstat (limited to 'Lib/test/test_unpack.py')
-rw-r--r-- | Lib/test/test_unpack.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py index d1ccb38..3fcb18f 100644 --- a/Lib/test/test_unpack.py +++ b/Lib/test/test_unpack.py @@ -117,6 +117,27 @@ error) ... test.test_unpack.BozoError +Allow unpacking empty iterables + + >>> () = [] + >>> [] = () + >>> [] = [] + >>> () = () + +Unpacking non-iterables should raise TypeError + + >>> () = 42 + Traceback (most recent call last): + ... + TypeError: 'int' object is not iterable + +Unpacking to an empty iterable should raise ValueError + + >>> () = [42] + Traceback (most recent call last): + ... + ValueError: too many values to unpack (expected 0) + """ __test__ = {'doctests' : doctests} |