diff Lib/test/test_socket.py @ 57037:c78a00a1d6db 2.6

Merged revisions 69519 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r69519 | gregory.p.smith | 2009-02-11 15:45:25 -0800 (Wed, 11 Feb 2009) | 3 lines Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even on LP64 platforms (most 64-bit Linux, bsd, unix systems). ........
author Gregory P. Smith <greg@mad-scientist.com>
date Sun, 01 Nov 2009 20:28:48 +0000
parents 58ba85c0d4b0
children dca3cb19dbdd
line wrap: on
line diff
--- a/Lib/test/test_socket.py	Sun Nov 01 20:05:41 2009 +0000
+++ b/Lib/test/test_socket.py	Sun Nov 01 20:28:48 2009 +0000
@@ -385,6 +385,14 @@
         # Check that setting it to an invalid type raises TypeError
         self.assertRaises(TypeError, socket.setdefaulttimeout, "spam")
 
+    def testIPv4_inet_aton_fourbytes(self):
+        if not hasattr(socket, 'inet_aton'):
+            return  # No inet_aton, nothing to check
+        # Test that issue1008086 and issue767150 are fixed.
+        # It must return 4 bytes.
+        self.assertEquals('\x00'*4, socket.inet_aton('0.0.0.0'))
+        self.assertEquals('\xff'*4, socket.inet_aton('255.255.255.255'))
+
     def testIPv4toString(self):
         if not hasattr(socket, 'inet_pton'):
             return # No inet_pton() on this platform