summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_file.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-05-31 00:35:52 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-05-31 00:35:52 (GMT)
commitcb87bc8e7ee3a2ffd83dd1b12fcfa1c01aa740aa (patch)
treef9e95a569fd2b935cccbdd0a2ba2ea88d8348276 /Lib/test/test_file.py
parent691d80532b0a0204e92de35ecba1472d87af6e94 (diff)
downloadcpython-cb87bc8e7ee3a2ffd83dd1b12fcfa1c01aa740aa.zip
cpython-cb87bc8e7ee3a2ffd83dd1b12fcfa1c01aa740aa.tar.gz
cpython-cb87bc8e7ee3a2ffd83dd1b12fcfa1c01aa740aa.tar.bz2
Add weakref support to array.array and file objects.
Diffstat (limited to 'Lib/test/test_file.py')
-rw-r--r--Lib/test/test_file.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py
index 22db9a2..ddd0471 100644
--- a/Lib/test/test_file.py
+++ b/Lib/test/test_file.py
@@ -1,10 +1,25 @@
import sys
import os
from array import array
+from weakref import proxy
from test.test_support import verify, TESTFN, TestFailed
from UserList import UserList
+# verify weak references
+f = file(TESTFN, 'w')
+p = proxy(f)
+p.write('teststring')
+verify(f.tell(), p.tell())
+f.close()
+f = None
+try:
+ p.tell()
+except ReferenceError:
+ pass
+else:
+ raise TestFailed('file proxy still exists when the file is gone')
+
# verify expected attributes exist
f = file(TESTFN, 'w')
softspace = f.softspace