summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socket.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r--Lib/test/test_socket.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index db32335..62c2e25 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -993,7 +993,7 @@ class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
ThreadableTest.__init__(self)
def clientSetUp(self):
- pass
+ self.source_port = support.find_unused_port()
def clientTearDown(self):
self.cli.close()
@@ -1008,6 +1008,19 @@ class NetworkConnectionAttributesTest(SocketTCPTest, ThreadableTest):
self.cli = socket.create_connection((HOST, self.port), timeout=30)
self.assertEqual(self.cli.family, 2)
+ testSourcePort = _justAccept
+ def _testSourcePort(self):
+ self.cli = socket.create_connection((HOST, self.port), timeout=30,
+ source_address=('', self.source_port))
+ self.assertEqual(self.cli.getsockname()[1], self.source_port)
+
+ testSourceAddress = _justAccept
+ def _testSourceAddress(self):
+ self.cli = socket.create_connection(
+ (HOST, self.port), 30, ('127.0.0.1', self.source_port))
+ self.assertEqual(self.cli.getsockname(),
+ ('127.0.0.1', self.source_port))
+
testTimeoutDefault = _justAccept
def _testTimeoutDefault(self):
# passing no explicit timeout uses socket's global default