summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-04-26 18:46:01 (GMT)
committerThomas Wouters <thomas@python.org>2006-04-26 18:46:01 (GMT)
commitcda404bf367d0958c27f1649caa108f11bc696a1 (patch)
tree24eb0102b986fabeacb21cb5c7f666fdc465f058 /Lib/test
parent79b0f85867171d6d38fe9269520d5c22c5a30cb9 (diff)
downloadcpython-cda404bf367d0958c27f1649caa108f11bc696a1.zip
cpython-cda404bf367d0958c27f1649caa108f11bc696a1.tar.gz
cpython-cda404bf367d0958c27f1649caa108f11bc696a1.tar.bz2
Add tests for += and *= on strings, and fix the memory-use estimate for the
list.extend tests (they were estimating half the actual use.)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_bigmem.py40
1 files changed, 37 insertions, 3 deletions
diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py
index 92e9578..bb7bb54 100644
--- a/Lib/test/test_bigmem.py
+++ b/Lib/test/test_bigmem.py
@@ -696,6 +696,21 @@ class ListTest(unittest.TestCase):
def test_concat_large(self, size):
return self.basic_test_concat(size)
+ def basic_test_inplace_concat(self, size):
+ l = [sys.stdout] * size
+ l += l
+ self.assertEquals(len(l), size * 2)
+ self.failUnless(l[0] is l[-1])
+ self.failUnless(l[size - 1] is l[size + 1])
+
+ @bigmemtest(minsize=_2G // 2 + 2, memuse=8)
+ def test_inplace_concat_small(self, size):
+ return self.basic_test_inplace_concat(size)
+
+ @bigmemtest(minsize=_2G + 2, memuse=8)
+ def test_inplace_concat_large(self, size):
+ return self.basic_test_inplace_concat(size)
+
@bigmemtest(minsize=_2G // 5 + 10, memuse=8*5)
def test_contains(self, size):
l = [1, 2, 3, 4, 5] * size
@@ -781,7 +796,26 @@ class ListTest(unittest.TestCase):
def test_repeat_large(self, size):
return self.basic_test_repeat(size)
- # Test repr-result of >2G
+ def basic_test_inplace_repeat(self, size):
+ l = ['']
+ l *= size
+ self.assertEquals(len(l), size)
+ self.failUnless(l[0] is l[-1])
+ del l
+
+ l = [''] * size
+ l *= 2
+ self.assertEquals(len(l), size * 2)
+ self.failUnless(l[size - 1] is l[-1])
+
+ @bigmemtest(minsize=_2G // 2 + 2, memuse=16)
+ def test_inplace_repeat_small(self, size):
+ return self.basic_test_inplace_repeat(size)
+
+ @bigmemtest(minsize=_2G + 2, memuse=16)
+ def test_inplace_repeat_large(self, size):
+ return self.basic_test_inplace_repeat(size)
+
def basic_test_repr(self, size):
l = [0] * size
s = repr(l)
@@ -821,11 +855,11 @@ class ListTest(unittest.TestCase):
self.failUnless(l[0] is l[-1])
self.failUnless(l[size - 1] is l[size + 1])
- @bigmemtest(minsize=_2G // 2 + 2, memuse=8)
+ @bigmemtest(minsize=_2G // 2 + 2, memuse=16)
def test_extend_small(self, size):
return self.basic_test_extend(size)
- @bigmemtest(minsize=_2G + 2, memuse=8)
+ @bigmemtest(minsize=_2G + 2, memuse=16)
def test_extend_large(self, size):
return self.basic_test_extend(size)