From ed87ad876bf195b22d08eefb9328e548a30f8795 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 30 Oct 2001 02:33:02 +0000 Subject: [PATCH] Minimal test for __del__ hook. --- Lib/test/test_descr.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index e0c80ae8ca..58c4316717 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__": -- 2.50.1