[pypy-svn] r42143 - in pypy/dist/pypy: module/rsocket/test rlib/test

afa at codespeak.net afa at codespeak.net
Wed Apr 18 09:57:15 CEST 2007


Author: afa
Date: Wed Apr 18 09:57:15 2007
New Revision: 42143

Modified:
   pypy/dist/pypy/module/rsocket/test/test_sock_app.py
   pypy/dist/pypy/rlib/test/test_rsocket.py
Log:
rsocket: On Windows 2000, inet_aton is more tolerant and accept missing numbers


Modified: pypy/dist/pypy/module/rsocket/test/test_sock_app.py
==============================================================================
--- pypy/dist/pypy/module/rsocket/test/test_sock_app.py	(original)
+++ pypy/dist/pypy/module/rsocket/test/test_sock_app.py	Wed Apr 18 09:57:15 2007
@@ -241,7 +241,7 @@
     def test_aton_exceptions(self):
         import _socket
         tests = ["127.0.0.256", "127.0.0.255555555555555555", "127.2b.0.0",
-            "127.2.0.0.1", "127.2..0"]
+            "127.2.0.0.1", "127.2.0."]
         for ip in tests:
             raises(_socket.error, _socket.inet_aton, ip)
 

Modified: pypy/dist/pypy/rlib/test/test_rsocket.py
==============================================================================
--- pypy/dist/pypy/rlib/test/test_rsocket.py	(original)
+++ pypy/dist/pypy/rlib/test/test_rsocket.py	Wed Apr 18 09:57:15 2007
@@ -262,9 +262,17 @@
     assert inet_aton('1.2.3.4') == '\x01\x02\x03\x04'
     assert inet_aton('127.0.0.1') == '\x7f\x00\x00\x01'
     tests = ["127.0.0.256", "127.0.0.255555555555555555", "127.2b.0.0",
-        "127.2.0.0.1", "127.2..0"]
+        "127.2.0.0.1", "127.2.0."]
     for ip in tests:
         py.test.raises(SocketError, inet_aton, ip)
+
+    # Windows 2000: missing numbers are replaced by 0
+    for ip, aton in [("11..22.33", '\x0b\x00\x16\x21'),
+                     (".11.22.33", '\x00\x0b\x16\x21')]:
+        try:
+            assert inet_aton(ip) == aton
+        except SocketError:
+            pass
     
 class TestTCP:
     PORT = 50007



More information about the Pypy-commit mailing list