diff options
Diffstat (limited to 'Lib/test/test_socket.py')
| -rw-r--r-- | Lib/test/test_socket.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py index f7bf041..6e2f80c 100644 --- a/Lib/test/test_socket.py +++ b/Lib/test/test_socket.py @@ -9,6 +9,7 @@ import time import thread, threading import Queue import sys +from weakref import proxy PORT = 50007 HOST = 'localhost' @@ -191,6 +192,19 @@ class SocketConnectedTest(ThreadedTCPSocketTest): class GeneralModuleTests(unittest.TestCase): + def test_weakref(self): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + p = proxy(s) + self.assertEqual(p.fileno(), s.fileno()) + s.close() + s = None + try: + p.fileno() + except ReferenceError: + pass + else: + self.fail('Socket proxy still exists') + def testSocketError(self): # Testing socket module exceptions def raise_error(*args, **kwargs): |
