MCPcopy Index your code
hub / github.com/python/cpython / testCloseException

Method testCloseException

Lib/test/test_socket.py:1609–1619  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1607 self.assertRaises(OSError, sock.send, b"spam")
1608
1609 def testCloseException(self):
1610 sock = socket.socket()
1611 sock.bind((socket._LOCALHOST, 0))
1612 socket.socket(fileno=sock.fileno()).close()
1613 try:
1614 sock.close()
1615 except OSError as err:
1616 # Winsock apparently raises ENOTSOCK
1617 self.assertIn(err.errno, (errno.EBADF, errno.ENOTSOCK))
1618 else:
1619 self.fail("close() should raise EBADF/ENOTSOCK")
1620
1621 def testNewAttributes(self):
1622 # testing .family, .type and .protocol

Callers

nothing calls this directly

Calls 6

socketMethod · 0.80
assertInMethod · 0.80
bindMethod · 0.45
closeMethod · 0.45
filenoMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected