Skip to content

Commit 3730c02

Browse files
committed
Cleanup test_finish()
1 parent 88e12b2 commit 3730c02

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎Lib/test/test_capi/test_set.py‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,22 @@ def test_update_array_steal(self):
392392
self.check_update_method('update_array_steal')
393393

394394
def test_finish(self):
395-
# Test PyFrozenSetWriter_Finish(): track the frozenset in the GC if at
396-
# least one item is tracked by the GC
395+
# Test PyFrozenSetWriter_Finish(): only track the frozenset in the GC
396+
# if at least one item is tracked by the GC
397+
398+
# Integers are not tracked by the GC
399+
items = [2, 5, 7]
400+
self.assertTrue(all(not gc.is_tracked(item) for item in items))
397401
writer = self.create_writer()
398-
writer.update([2, 5, 7])
402+
writer.update(items)
399403
self.assertFalse(gc.is_tracked(writer.finish()))
400404

405+
# Create an object tracked by the GC
401406
class MyObject:
402407
pass
403-
404408
obj = MyObject()
409+
self.assertTrue(gc.is_tracked(obj))
410+
405411
writer = self.create_writer()
406412
writer.add(obj)
407413
self.assertTrue(gc.is_tracked(writer.finish()))

0 commit comments

Comments
 (0)