mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
Correct API design mistake from rev. 43126: make socket attributes readonly properties.
This commit is contained in:
parent
9ca8789ee3
commit
bb03ac0dae
3 changed files with 28 additions and 38 deletions
|
@ -469,12 +469,12 @@ class GeneralModuleTests(unittest.TestCase):
|
|||
sock.close()
|
||||
self.assertRaises(socket.error, sock.send, "spam")
|
||||
|
||||
def testNewGetMethods(self):
|
||||
# testing getfamily(), gettype() and getprotocol()
|
||||
def testNewAttributes(self):
|
||||
# testing .family, .type and .protocol
|
||||
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)
|
||||
self.assertEqual(sock.family, socket.AF_INET)
|
||||
self.assertEqual(sock.type, socket.SOCK_STREAM)
|
||||
self.assertEqual(sock.proto, 0)
|
||||
sock.close()
|
||||
|
||||
class BasicTCPTest(SocketConnectedTest):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue