Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_array.py @ 32159:2c169ca5fa69 legacy-trunk
Add weakref support to array.array and file objects.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Mon, 31 May 2004 00:35:52 +0000 |
| parents | 35f56e08727f |
| children | 0b181bf230c9 |
line wrap: on
line diff
--- a/Lib/test/test_array.py Sun May 30 07:26:47 2004 +0000 +++ b/Lib/test/test_array.py Mon May 31 00:35:52 2004 +0000 @@ -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 @@ 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 @@ b = array.array('B', range(64)) self.assertEqual(rc, sys.getrefcount(10)) + + class StringTest(BaseTest): def test_setitem(self):
