[pypy-svn] r73060 - pypy/trunk/pypy/objspace/std/test

benjamin at codespeak.net benjamin at codespeak.net
Mon Mar 29 01:48:35 CEST 2010


Author: benjamin
Date: Mon Mar 29 01:48:32 2010
New Revision: 73060

Modified:
   pypy/trunk/pypy/objspace/std/test/test_listobject.py
Log:
test for optimized list getitem

Modified: pypy/trunk/pypy/objspace/std/test/test_listobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/test/test_listobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/test/test_listobject.py	Mon Mar 29 01:48:32 2010
@@ -2,6 +2,7 @@
 from pypy.objspace.std.listobject import W_ListObject
 from pypy.interpreter.error import OperationError
 
+from pypy.conftest import gettestobjspace
 
 
 class TestW_ListObject:
@@ -769,3 +770,18 @@
         l = [1,2,3,4]
         l.__delslice__(0, 2)
         assert l == [3, 4]
+
+
+class AppTestListFastSubscr:
+
+    def setup_class(cls):
+        cls.space = gettestobjspace(**{"objspace.std.optimized_list_getitem" :
+                                       True})
+
+    def test_getitem(self):
+        import operator
+        l = [0, 1, 2, 3, 4]
+        for i in xrange(5):
+            assert l[i] == i
+        assert l[3:] == [3, 4]
+        raises(TypeError, operator.getitem, l, "str")



More information about the Pypy-commit mailing list