summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-10-05 15:47:01 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-10-05 15:47:01 (GMT)
commit861470c83607a4312d3c65bce3e18414b965e586 (patch)
tree48088d67e50d8599b00498c17b5c8b7a35b482f8 /Lib/test/test_socket.py
parentd577cea8ab0d929c40de93947dd68b9709607b35 (diff)
downloadcpython-861470c83607a4312d3c65bce3e18414b965e586.zip
cpython-861470c83607a4312d3c65bce3e18414b965e586.tar.gz
cpython-861470c83607a4312d3c65bce3e18414b965e586.tar.bz2
#16518: Bring error messages in harmony with docs ("bytes-like object")
Some time ago we changed the docs to consistently use the term 'bytes-like object' in all the contexts where bytes, bytearray, memoryview, etc are used. This patch (by Ezio Melotti) completes that work by changing the error messages that previously reported that certain types did "not support the buffer interface" to instead say that a bytes-like object is required. (The glossary entry for bytes-like object references the discussion of the buffer protocol in the docs.)
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 98ee615..3f2057b 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -711,11 +711,11 @@ class GeneralModuleTests(unittest.TestCase):
with self.assertRaises(TypeError) as cm:
s.sendto('\u2620', sockname)
self.assertEqual(str(cm.exception),
- "'str' does not support the buffer interface")
+ "a bytes-like object is required, not 'str'")
with self.assertRaises(TypeError) as cm:
s.sendto(5j, sockname)
self.assertEqual(str(cm.exception),
- "'complex' does not support the buffer interface")
+ "a bytes-like object is required, not 'complex'")
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', None)
self.assertIn('not NoneType',str(cm.exception))
@@ -723,11 +723,11 @@ class GeneralModuleTests(unittest.TestCase):
with self.assertRaises(TypeError) as cm:
s.sendto('\u2620', 0, sockname)
self.assertEqual(str(cm.exception),
- "'str' does not support the buffer interface")
+ "a bytes-like object is required, not 'str'")
with self.assertRaises(TypeError) as cm:
s.sendto(5j, 0, sockname)
self.assertEqual(str(cm.exception),
- "'complex' does not support the buffer interface")
+ "a bytes-like object is required, not 'complex'")
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', 0, None)
self.assertIn('not NoneType', str(cm.exception))