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

Method test_socket_close

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

Source from the content-addressed store, hash-verified

1903 self.assertRaises(ValueError, fp.seekable)
1904
1905 def test_socket_close(self):
1906 sock = socket.socket()
1907 try:
1908 sock.bind((HOST, 0))
1909 socket.close(sock.fileno())
1910 with self.assertRaises(OSError):
1911 sock.listen(1)
1912 finally:
1913 with self.assertRaises(OSError):
1914 # sock.close() fails with EBADF
1915 sock.close()
1916 with self.assertRaises(TypeError):
1917 socket.close(None)
1918 with self.assertRaises(OSError):
1919 socket.close(-1)
1920
1921 def test_makefile_mode(self):
1922 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