Author: Manuel Jacob <m...@manueljacob.de>
Branch: py3k
Changeset: r82579:a3d2806acab8
Date: 2016-02-27 01:23 +0100
http://bitbucket.org/pypy/pypy/changeset/a3d2806acab8/

Log:    Port failing test from eea8f92e03.

        eea8f92e03 should have been done in py3k. I'm going to apply the
        rpython changes to default to reduce differences between branches.
        After that I'll port the changes to fix the test.

diff --git a/pypy/module/_socket/test/test_sock_app.py 
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -614,7 +614,7 @@
         import _socket
         self.foo = _socket.socket()
 
-    def test_subclass(self):
+    def test_subclass_init(self):
         # Socket is not created in __new__, but in __init__.
         import socket
         class Socket_IPV6(socket.socket):
@@ -622,6 +622,18 @@
                 socket.socket.__init__(self, family=socket.AF_INET6)
         assert Socket_IPV6().family == socket.AF_INET6
 
+    def test_subclass_noinit(self):
+        from _socket import socket
+        class MySock(socket):
+            def __init__(self, *args):
+                pass  # don't call super
+        s = MySock()
+        assert s.type == 0
+        assert s.proto == 0
+        assert s.family == 0
+        assert s.fileno() < 0
+        raises(OSError, s.bind, ('localhost', 0))
+
     def test_dealloc_warn(self):
         import _socket
         import gc
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to