From: Tim Peters Date: Sat, 10 Aug 2002 21:29:56 +0000 (+0000) Subject: test_saveall(): Simplified a little, given that we only expect one item X-Git-Tag: v2.3c1~4554 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4803c126a683b54622e49d996b1a56993a68b6f3;p=thirdparty%2FPython%2Fcpython.git test_saveall(): Simplified a little, given that we only expect one item in gc.garbage (so no need to loop looking for it -- it's there or it's not). --- diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py index 46448badd1bc..2e1bc11ab94b 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py @@ -180,16 +180,14 @@ def test_saveall(): l.append(l) id_l = id(l) del l + gc.collect() - vereq(len(gc.garbage), 1) try: - for obj in gc.garbage: - if id(obj) == id_l: - del obj[:] - break + vereq(len(gc.garbage), 1) + if id(gc.garbage[0]) == id_l: + del gc.garbage[0] else: raise TestFailed, "didn't find obj in garbage (saveall)" - gc.garbage.remove(obj) finally: gc.set_debug(debug)