From cb87bc8e7ee3a2ffd83dd1b12fcfa1c01aa740aa Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Mon, 31 May 2004 00:35:52 +0000 Subject: Add weakref support to array.array and file objects. --- Lib/test/test_array.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Lib/test/test_array.py') diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 0f3e07f1729..d03618d04fa 100755 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -5,6 +5,7 @@ import unittest from test import test_support +from weakref import proxy import array, cStringIO, math tests = [] # list to accumulate all tests @@ -614,6 +615,13 @@ def test_buffer(self): b = buffer(a) self.assertEqual(b[0], a.tostring()[0]) + def test_weakref(self): + s = array.array(self.typecode, self.example) + p = proxy(s) + self.assertEqual(p.tostring(), s.tostring()) + s = None + self.assertRaises(ReferenceError, len, p) + def test_bug_782369(self): import sys if hasattr(sys, "getrefcount"): @@ -624,6 +632,8 @@ def test_bug_782369(self): b = array.array('B', range(64)) self.assertEqual(rc, sys.getrefcount(10)) + + class StringTest(BaseTest): def test_setitem(self): -- cgit v1.2.3-65-gdbad