summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_list.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_list.py')
-rw-r--r--Lib/test/test_list.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_list.py b/Lib/test/test_list.py
index b3b2195..3b85117 100644
--- a/Lib/test/test_list.py
+++ b/Lib/test/test_list.py
@@ -4,6 +4,22 @@ from test import test_support, list_tests
class ListTest(list_tests.CommonTest):
type2test = list
+ def test_basic(self):
+ self.assertEqual(list([]), [])
+ l0_3 = [0, 1, 2, 3]
+ l0_3_bis = list(l0_3)
+ self.assertEqual(l0_3, l0_3_bis)
+ self.assert_(l0_3 is not l0_3_bis)
+ self.assertEqual(list(()), [])
+ self.assertEqual(list((0, 1, 2, 3)), [0, 1, 2, 3])
+ self.assertEqual(list(''), [])
+ self.assertEqual(list('spam'), ['s', 'p', 'a', 'm'])
+
+ # This code used to segfault in Py2.4a3
+ x = []
+ x.extend(-y for y in x)
+ self.assertEqual(x, [])
+
def test_truth(self):
super().test_truth()
self.assert_(not [])