MCPcopy Index your code
hub / github.com/RustPython/RustPython / testCloseException

Method testCloseException

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

Source from the content-addressed store, hash-verified

1556 self.assertRaises(OSError, sock.send, b"spam")
1557
1558 def testCloseException(self):
1559 sock = socket.socket()
1560 sock.bind((socket._LOCALHOST, 0))
1561 socket.socket(fileno=sock.fileno()).close()
1562 try:
1563 sock.close()
1564 except OSError as err:
1565 # Winsock apparently raises ENOTSOCK
1566 self.assertIn(err.errno, (errno.EBADF, errno.ENOTSOCK))
1567 else:
1568 self.fail("close() should raise EBADF/ENOTSOCK")
1569
1570 def testNewAttributes(self):
1571 # 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