summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-30 02:33:02 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-30 02:33:02 (GMT)
commited87ad876bf195b22d08eefb9328e548a30f8795 (patch)
treec94626ef01fa39ee793330084cc661b4c7a96ee9 /Lib/test/test_descr.py
parentc32410ae8fce0bb588cdf2342c0a7de08ed2fba1 (diff)
downloadcpython-ed87ad876bf195b22d08eefb9328e548a30f8795.zip
cpython-ed87ad876bf195b22d08eefb9328e548a30f8795.tar.gz
cpython-ed87ad876bf195b22d08eefb9328e548a30f8795.tar.bz2
Minimal test for __del__ hook.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index e0c80ae..58c4316 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -2408,6 +2408,17 @@ def kwdargs():
list.__init__(a, sequence=[0, 1, 2])
vereq(a, [0, 1, 2])
+def delhook():
+ if verbose: print "Testing __del__ hook..."
+ log = []
+ class C(object):
+ def __del__(self):
+ log.append(1)
+ c = C()
+ vereq(log, [])
+ del c
+ vereq(log, [1])
+
def test_main():
class_docstrings()
lists()
@@ -2459,6 +2470,7 @@ def test_main():
buffer_inherit()
str_of_str_subclass()
kwdargs()
+ delhook()
if verbose: print "All OK"
if __name__ == "__main__":