summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_list.py11
-rw-r--r--Lib/test/test_tuple.py10
2 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index 3510bd5..d7e6629 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -59,6 +59,17 @@ class ListTest(list_tests.CommonTest):
self.assertRaises((MemoryError, OverflowError), mul, lst, n)
self.assertRaises((MemoryError, OverflowError), imul, lst, n)
+ def test_repr_large(self):
+ # Check the repr of large list objects
+ def check(n):
+ l = [0] * n
+ s = repr(l)
+ self.assertEqual(s,
+ '[' + ', '.join(['0'] * n) + ']')
+ check(10) # check our checking code
+ check(1000000)
+
+
def test_main(verbose=None):
support.run_unittest(ListTest)
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
index 75fbe45..1464a0e 100644
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -154,6 +154,16 @@ class TupleTest(seq_tests.CommonTest):
# Trying to untrack an unfinished tuple could crash Python
self._not_tracked(tuple(gc.collect() for i in range(101)))
+ def test_repr_large(self):
+ # Check the repr of large list objects
+ def check(n):
+ l = (0,) * n
+ s = repr(l)
+ self.assertEqual(s,
+ '(' + ', '.join(['0'] * n) + ')')
+ check(10) # check our checking code
+ check(1000000)
+
def test_main():
support.run_unittest(TupleTest)