mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
RFE #567972: Socket objects' family, type and proto properties are
now exposed via new get...() methods.
This commit is contained in:
parent
5c170fd4a9
commit
bc45a3f821
5 changed files with 55 additions and 2 deletions
|
@ -469,6 +469,14 @@ class GeneralModuleTests(unittest.TestCase):
|
|||
sock.close()
|
||||
self.assertRaises(socket.error, sock.send, "spam")
|
||||
|
||||
def testNewGetMethods(self):
|
||||
# testing getfamily(), gettype() and getprotocol()
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.assertEqual(sock.getfamily(), socket.AF_INET)
|
||||
self.assertEqual(sock.gettype(), socket.SOCK_STREAM)
|
||||
self.assertEqual(sock.getproto(), 0)
|
||||
sock.close()
|
||||
|
||||
class BasicTCPTest(SocketConnectedTest):
|
||||
|
||||
def __init__(self, methodName='runTest'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue