summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-12-26 12:30:41 +0200
committerGitHub <noreply@github.com>2017-12-26 12:30:41 +0200
commit13a6c098c215921e35004f9d3a9b70f601e56500 (patch)
treecda014f1d730c1b10abc45484b9e2cf7ea04aa33 /Lib/test
parenta8f4e15f3d33084862ddd3a7d58cd00034e94f16 (diff)
downloadcpython-git-13a6c098c215921e35004f9d3a9b70f601e56500.tar.gz
bpo-32259: Make a TypeError message when unpack non-iterable more specific. (#4903)
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/test_dataclasses.py2
-rw-r--r--Lib/test/test_unpack.py4
-rw-r--r--Lib/test/test_unpack_ex.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_dataclasses.py b/Lib/test/test_dataclasses.py
index 18ca202ca7..7fbea76ccd 100755
--- a/Lib/test/test_dataclasses.py
+++ b/Lib/test/test_dataclasses.py
@@ -866,7 +866,7 @@ class TestCase(unittest.TestCase):
self.assertNotEqual(Point3D(1, 2, 3), (1, 2, 3))
# Make sure we can't unpack
- with self.assertRaisesRegex(TypeError, 'is not iterable'):
+ with self.assertRaisesRegex(TypeError, 'unpack'):
x, y, z = Point3D(4, 5, 6)
# Maka sure another class with the same field names isn't
diff --git a/Lib/test/test_unpack.py b/Lib/test/test_unpack.py
index 3fcb18fb43..1c0c523d68 100644
--- a/Lib/test/test_unpack.py
+++ b/Lib/test/test_unpack.py
@@ -55,7 +55,7 @@ Unpacking non-sequence
>>> a, b, c = 7
Traceback (most recent call last):
...
- TypeError: 'int' object is not iterable
+ TypeError: cannot unpack non-iterable int object
Unpacking tuple of wrong size
@@ -129,7 +129,7 @@ Unpacking non-iterables should raise TypeError
>>> () = 42
Traceback (most recent call last):
...
- TypeError: 'int' object is not iterable
+ TypeError: cannot unpack non-iterable int object
Unpacking to an empty iterable should raise ValueError
diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py
index 6be8f551fc..45cf051f1e 100644
--- a/Lib/test/test_unpack_ex.py
+++ b/Lib/test/test_unpack_ex.py
@@ -263,7 +263,7 @@ Unpacking non-sequence
>>> a, *b = 7
Traceback (most recent call last):
...
- TypeError: 'int' object is not iterable
+ TypeError: cannot unpack non-iterable int object
Unpacking sequence too short