diff options
author | Guido van Rossum <guido@python.org> | 2001-10-30 02:33:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-10-30 02:33:02 (GMT) |
commit | ed87ad876bf195b22d08eefb9328e548a30f8795 (patch) | |
tree | c94626ef01fa39ee793330084cc661b4c7a96ee9 /Lib/test | |
parent | c32410ae8fce0bb588cdf2342c0a7de08ed2fba1 (diff) | |
download | cpython-ed87ad876bf195b22d08eefb9328e548a30f8795.zip cpython-ed87ad876bf195b22d08eefb9328e548a30f8795.tar.gz cpython-ed87ad876bf195b22d08eefb9328e548a30f8795.tar.bz2 |
Minimal test for __del__ hook.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_descr.py | 12 |
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__": |