(self)
| 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): |
nothing calls this directly
no test coverage detected