[pypy-svn] r15822 - pypy/dist/pypy/lib/test2

pedronis at codespeak.net pedronis at codespeak.net
Tue Aug 9 16:43:02 CEST 2005


Author: pedronis
Date: Tue Aug  9 16:43:02 2005
New Revision: 15822

Modified:
   pypy/dist/pypy/lib/test2/test_deque_extra.py
Log:
fall-back so that this test (which is run on top of CPython) can pass on 2.3 too



Modified: pypy/dist/pypy/lib/test2/test_deque_extra.py
==============================================================================
--- pypy/dist/pypy/lib/test2/test_deque_extra.py	(original)
+++ pypy/dist/pypy/lib/test2/test_deque_extra.py	Tue Aug  9 16:43:02 2005
@@ -1,6 +1,11 @@
 # Deque Tests
 
-
+# for passing the test on top of 2.3
+try:
+    reversed
+except NameError:
+    def reversed(seq): # fall-back
+        return seq.__reversed__()
 
 n = 10
 class Test_deque:
@@ -14,7 +19,7 @@
         assert len(self.d) == n
         for i in range(n):
             assert i == self.d[i]
-        for i in reversed(range(n)):
+        for i in range(n-1, -1, -1):
             assert self.d.pop() == i
             
     def test_deque_iter(self):
@@ -35,4 +40,4 @@
         self.d.pop()
         raises(RuntimeError,it.next)
         assert len(it) == 0
-        assert list(it) == []
\ No newline at end of file
+        assert list(it) == []



More information about the Pypy-commit mailing list