summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gc.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-10 21:29:56 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-10 21:29:56 (GMT)
commit4803c126a683b54622e49d996b1a56993a68b6f3 (patch)
treeebd4d9ed069919c6cd0b01754f510b00a1adb934 /Lib/test/test_gc.py
parentc708c0a8c41de2c14587d8683c6b6a91d06c97bf (diff)
downloadcpython-4803c126a683b54622e49d996b1a56993a68b6f3.zip
cpython-4803c126a683b54622e49d996b1a56993a68b6f3.tar.gz
cpython-4803c126a683b54622e49d996b1a56993a68b6f3.tar.bz2
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).
Diffstat (limited to 'Lib/test/test_gc.py')
-rw-r--r--Lib/test/test_gc.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 46448ba..2e1bc11 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)