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

Method test_socket_close

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

Source from the content-addressed store, hash-verified

1852 self.assertRaises(ValueError, fp.seekable)
1853
1854 def test_socket_close(self):
1855 sock = socket.socket()
1856 try:
1857 sock.bind((HOST, 0))
1858 socket.close(sock.fileno())
1859 with self.assertRaises(OSError):
1860 sock.listen(1)
1861 finally:
1862 with self.assertRaises(OSError):
1863 # sock.close() fails with EBADF
1864 sock.close()
1865 with self.assertRaises(TypeError):
1866 socket.close(None)
1867 with self.assertRaises(OSError):
1868 socket.close(-1)
1869
1870 def test_makefile_mode(self):
1871 for mode in 'r', 'rb', 'rw', 'w', 'wb':

Callers

nothing calls this directly

Calls 6

socketMethod · 0.80
bindMethod · 0.45
closeMethod · 0.45
filenoMethod · 0.45
assertRaisesMethod · 0.45
listenMethod · 0.45

Tested by

no test coverage detected