diff options
Diffstat (limited to 'Lib/test/test_socket.py')
-rw-r--r-- | Lib/test/test_socket.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 2602b22..ffa2587 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -372,6 +372,16 @@ class GeneralModuleTests(unittest.TestCase): finally: socket.sethostname(oldhn) + @unittest.skipUnless(hasattr(socket, 'if_nameindex'), + 'socket.if_nameindex() not available.') + def testInterfaceNameIndex(self): + interfaces = socket.if_nameindex() + for index, name in interfaces: + # interface indices are non-zero integers + self.assertGreater(index, 0) + self.assertEqual(index, socket.if_nametoindex(name)) + self.assertEqual(name, socket.if_indextoname(index)) + def testRefCountGetNameInfo(self): # Testing reference count for getnameinfo if hasattr(sys, "getrefcount"): |