summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-14 14:43:44 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-14 14:43:44 (GMT)
commita468adc76d7e946b073579b783b246eb5e53850e (patch)
tree115cf23843f4e19f52aa8b611ed42817571649a3 /Lib/test/test_ssl.py
parent9bfc0f098474c841a40d27b9aa0be2fd085a6a53 (diff)
downloadcpython-a468adc76d7e946b073579b783b246eb5e53850e.zip
cpython-a468adc76d7e946b073579b783b246eb5e53850e.tar.gz
cpython-a468adc76d7e946b073579b783b246eb5e53850e.tar.bz2
Issue #9853: Fix the signature of SSLSocket.recvfrom() and
SSLSocket.sendto() to match the corresponding socket methods.
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 748406a..6b79615 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -163,6 +163,18 @@ class BasicSocketTests(unittest.TestCase):
del ss
self.assertEqual(wr(), None)
+ def test_wrapped_unconnected(self):
+ # Methods on an unconnected SSLSocket propagate the original
+ # socket.error raise by the underlying socket object.
+ s = socket.socket(socket.AF_INET)
+ ss = ssl.wrap_socket(s)
+ self.assertRaises(socket.error, ss.recv, 1)
+ self.assertRaises(socket.error, ss.recv_into, bytearray(b'x'))
+ self.assertRaises(socket.error, ss.recvfrom, 1)
+ self.assertRaises(socket.error, ss.recvfrom_into, bytearray(b'x'), 1)
+ self.assertRaises(socket.error, ss.send, b'x')
+ self.assertRaises(socket.error, ss.sendto, b'x', ('0.0.0.0', 0))
+
def test_timeout(self):
# Issue #8524: when creating an SSL socket, the timeout of the
# original socket should be retained.