diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-14 18:00:02 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-14 18:00:02 (GMT) |
commit | 9e0b864ac07ab85b618ccf3831eae97b2c91fb2e (patch) | |
tree | 195459e4f65f8d63c3ecd298f6d3790055a73b81 /Lib/test/test_socket.py | |
parent | 38615993b0b13729cc2afaa69686f5bff17547c4 (diff) | |
download | cpython-9e0b864ac07ab85b618ccf3831eae97b2c91fb2e.zip cpython-9e0b864ac07ab85b618ccf3831eae97b2c91fb2e.tar.gz cpython-9e0b864ac07ab85b618ccf3831eae97b2c91fb2e.tar.bz2 |
Issue #1552: socket.socketpair() now returns regular socket.socket
objects supporting the whole socket API (rather than the "raw"
_socket.socket objects).
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 05b6ca7..690d9b5 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -714,6 +714,7 @@ class BasicTCPTest(SocketConnectedTest): # Testing fromfd() fd = self.cli_conn.fileno() sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM) + self.assertIsInstance(sock, socket.socket) msg = sock.recv(1024) self.assertEqual(msg, MSG) @@ -814,6 +815,23 @@ class BasicSocketPairTest(SocketPairTest): def __init__(self, methodName='runTest'): SocketPairTest.__init__(self, methodName=methodName) + def _testDefaults(self): + pass + + def testDefaults(self): + self.assertIsInstance(self.cli, socket.socket) + self.assertIsInstance(self.serv, socket.socket) + if hasattr(socket, 'AF_UNIX'): + self.assertEqual(self.cli.family, socket.AF_UNIX) + self.assertEqual(self.serv.family, socket.AF_UNIX) + else: + self.assertEqual(self.cli.family, socket.AF_INET) + self.assertEqual(self.serv.family, socket.AF_INET) + self.assertEqual(self.cli.type, socket.SOCK_STREAM) + self.assertEqual(self.serv.type, socket.SOCK_STREAM) + self.assertEqual(self.cli.proto, 0) + self.assertEqual(self.serv.proto, 0) + def testRecv(self): msg = self.serv.recv(1024) self.assertEqual(msg, MSG) |