diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index 016dd3c55ef..3dea4e0c09b 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -248,15 +248,19 @@ def testInterpreterCrash(self): except socket.error: pass - def testNtoH(self): - for func in socket.htonl, socket.ntohl: - for i in (0, 1, ~0xffff, 2L): - self.assertEqual(i, func(func(i))) + def testNtoHL(self): + # This just checks that htons etc. are their own inverse, + # when looking at the lower 16 or 32 bits. + sizes = {socket.htonl: 32, socket.ntohl: 32, + socket.htons: 16, socket.ntohs: 16} + for func, size in sizes.items(): + mask = (1L<