Commits

Thomas Wouters committed 22bb5c6

Some more test-size-estimate fixes: test_append and test_insert trigger a
list resize, which overallocates.

  • Participants
  • Parent commits 9cc12bb
  • Branches legacy-trunk

Comments (0)

Files changed (1)

Lib/test/test_bigmem.py

     def test_repr_large(self, size):
         return self.basic_test_repr(size)
 
-
-    @bigmemtest(minsize=_2G, memuse=8)
+    # list overallocates ~1/8th of the total size (on first expansion) so
+    # the single list.append call puts memuse at 9 bytes per size.
+    @bigmemtest(minsize=_2G, memuse=9)
     def test_append(self, size):
         l = [object()] * size
         l.append(object())
         self.assertRaises(ValueError, l.index, 1, size - 4, size)
         self.assertRaises(ValueError, l.index, 6L)
 
-    @bigmemtest(minsize=_2G + 10, memuse=8)
+    # This tests suffers from overallocation, just like test_append.
+    @bigmemtest(minsize=_2G + 10, memuse=9)
     def test_insert(self, size):
         l = [1.0] * size
         l.insert(size - 1, "A")
         size -= 1
         self.assertEquals(len(l), size)
 
+        # Because of the earlier l.remove(), this append doesn't trigger
+        # a resize.
         l.append(5)
         size += 1
         self.assertEquals(len(l), size)