[Python-checkins] python/dist/src/Lib/test test_socket.py,1.57,1.58
gvanrossum@users.sourceforge.net
gvanrossum@users.sourceforge.net
Fri, 13 Sep 2002 17:58:48 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv4176
Modified Files:
test_socket.py
Log Message:
Maybe this fixes test_socket on 64-bit Linux.
Index: test_socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** test_socket.py 6 Sep 2002 21:57:50 -0000 1.57
--- test_socket.py 14 Sep 2002 00:58:46 -0000 1.58
***************
*** 249,261 ****
pass
! def testNtoH(self):
! for func in socket.htonl, socket.ntohl:
! for i in (0, 1, ~0xffff, 2L):
! self.assertEqual(i, func(func(i)))
! biglong = 2**32L - 1
! swapped = func(biglong)
! self.assert_(swapped == biglong or swapped == -1)
! self.assertRaises(OverflowError, func, 2L**34)
def testGetServByName(self):
--- 249,265 ----
pass
! 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<<size) - 1
! for i in (0, 1, 0xffff, ~0xffff, 2, 0x01234567, 0x76543210):
! self.assertEqual(i & mask, func(func(i&mask)) & mask)
! swapped = func(mask)
! self.assertEqual(swapped & mask, mask)
! self.assertRaises(OverflowError, func, 1L<<34)
def testGetServByName(self):