RFE #567972: Socket objects' family, type and proto properties are

now exposed via new get...() methods.
This commit is contained in:
Georg Brandl 2006-03-17 19:17:34 +00:00
parent 5c170fd4a9
commit bc45a3f821
5 changed files with 55 additions and 2 deletions

View file

@ -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'):