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

Method test_socket_fileno

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

Source from the content-addressed store, hash-verified

2072 self.assertEqual(s2.fileno(), fd)
2073
2074 def test_socket_fileno(self):
2075 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
2076 self.addCleanup(s.close)
2077 s.bind((socket_helper.HOST, 0))
2078 self._test_socket_fileno(s, socket.AF_INET, socket.SOCK_STREAM)
2079
2080 if hasattr(socket, "SOCK_DGRAM"):
2081 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
2082 self.addCleanup(s.close)
2083 s.bind((socket_helper.HOST, 0))
2084 self._test_socket_fileno(s, socket.AF_INET, socket.SOCK_DGRAM)
2085
2086 if socket_helper.IPV6_ENABLED:
2087 s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
2088 self.addCleanup(s.close)
2089 s.bind((socket_helper.HOSTv6, 0, 0, 0))
2090 self._test_socket_fileno(s, socket.AF_INET6, socket.SOCK_STREAM)
2091
2092 if hasattr(socket, "AF_UNIX"):
2093 unix_name = socket_helper.create_unix_domain_name()
2094 self.addCleanup(os_helper.unlink, unix_name)
2095
2096 s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
2097 with s:
2098 try:
2099 s.bind(unix_name)
2100 except PermissionError:
2101 pass
2102 else:
2103 self._test_socket_fileno(s, socket.AF_UNIX,
2104 socket.SOCK_STREAM)
2105
2106 def test_socket_fileno_rejects_float(self):
2107 with self.assertRaises(TypeError):

Callers

nothing calls this directly

Calls 5

_test_socket_filenoMethod · 0.95
hasattrFunction · 0.85
socketMethod · 0.80
addCleanupMethod · 0.80
bindMethod · 0.45

Tested by

no test coverage detected