From a7eb93ec43e0ad18a0c78c93afb85e9cb9fd3f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20D=C3=B6rwald?= Date: Tue, 5 Jun 2007 13:41:53 +0000 Subject: [PATCH] Simplify socket_repr() by using PyUnicode_FromFormat() directly. Add a test that calls socket_repr(). --- Lib/test/test_socket.py | 4 ++++ Modules/socketmodule.c | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index cfb293fe19a..8ba2cebeb7d 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -217,6 +217,10 @@ class SocketPairTest(unittest.TestCase, ThreadableTest): class GeneralModuleTests(unittest.TestCase): + def test_repr(self): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + self.assert_(repr(s).startswith("", (long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto); - return PyUnicode_FromString(buf); }