summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unpack.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_unpack.py')
-rw-r--r--Lib/test/test_unpack.py21
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}