From a2627afe370dc6607be45d5b4cf7f73077507441 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 14 Sep 2002 00:58:46 +0000 Subject: [PATCH] Maybe this fixes test_socket on 64-bit Linux. --- Lib/test/test_socket.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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 @@ class GeneralModuleTests(unittest.TestCase): 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<