[pypy-svn] r57497 - in pypy/dist/pypy/module/itertools: . test

arigo at codespeak.net arigo at codespeak.net
Wed Aug 20 13:57:13 CEST 2008


Author: arigo
Date: Wed Aug 20 13:57:10 2008
New Revision: 57497

Added:
   pypy/dist/pypy/module/itertools/test/errors.txt   (contents, props changed)
Modified:
   pypy/dist/pypy/module/itertools/interp_itertools.py
   pypy/dist/pypy/module/itertools/test/test_itertools.py
Log:
CPython 2.5's test_itertools passes, except a number
of corner cases documented in errors.txt.


Modified: pypy/dist/pypy/module/itertools/interp_itertools.py
==============================================================================
--- pypy/dist/pypy/module/itertools/interp_itertools.py	(original)
+++ pypy/dist/pypy/module/itertools/interp_itertools.py	Wed Aug 20 13:57:10 2008
@@ -804,8 +804,8 @@
                     self.new_group = True #new group
                     raise StopIteration
 
-def W_GroupBy___new__(space, w_subtype, w_iterable, w_fun=None):
-    return space.wrap(W_GroupBy(space, w_iterable, w_fun))
+def W_GroupBy___new__(space, w_subtype, w_iterable, w_key=None):
+    return space.wrap(W_GroupBy(space, w_iterable, w_key))
 
 W_GroupBy.typedef = TypeDef(
         'groupby',

Added: pypy/dist/pypy/module/itertools/test/errors.txt
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/module/itertools/test/errors.txt	Wed Aug 20 13:57:10 2008
@@ -0,0 +1,64 @@
+
+
+Here are the remaining errors of CPython 2.5's test_itertools.  FWIW I
+consider them all as obscure undocumented implementation details.
+
+
+
+======================================================================
+ERROR: test_tee (__main__.TestBasicOps)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "itest25.py", line 376, in test_tee
+    c = type(a)('def')
+TypeError: default __new__ takes no parameters
+
+======================================================================
+ERROR: test_repeat (__main__.LengthTransparency)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "itest25.py", line 690, in test_repeat
+    from test.test_iterlen import len
+ImportError: cannot import name 'len'
+
+======================================================================
+ERROR: test_keywords_in_subclass (__main__.SubclassWithKwargsTest)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "itest25.py", line 760, in test_keywords_in_subclass
+    class Subclass(cls):
+TypeError: type 'repeat' is not an acceptable base class
+
+======================================================================
+FAIL: test_count (__main__.TestBasicOps)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "itest25.py", line 59, in test_count
+    self.assertEqual(repr(c), 'count(3)')
+AssertionError: '<count object at 0x08fcdcac>' != 'count(3)'
+
+======================================================================
+FAIL: test_imap (__main__.TestBasicOps)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "itest25.py", line 231, in test_imap
+    self.assertRaises(TypeError, imap, operator.neg)
+AssertionError: TypeError not raised
+
+======================================================================
+FAIL: test_izip (__main__.TestBasicOps)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "itest25.py", line 199, in test_izip
+    self.assertEqual(min(ids), max(ids))
+AssertionError: 149283404 != 150789644
+
+======================================================================
+FAIL: test_repeat (__main__.TestBasicOps)
+----------------------------------------------------------------------
+Traceback (most recent call last):
+  File "itest25.py", line 214, in test_repeat
+    self.assertEqual(repr(r), 'repeat((1+0j))')
+AssertionError: '<repeat object at 0x09124a2c>' != 'repeat((1+0j))'
+
+----------------------------------------------------------------------

Modified: pypy/dist/pypy/module/itertools/test/test_itertools.py
==============================================================================
--- pypy/dist/pypy/module/itertools/test/test_itertools.py	(original)
+++ pypy/dist/pypy/module/itertools/test/test_itertools.py	Wed Aug 20 13:57:10 2008
@@ -474,6 +474,14 @@
             raises(StopIteration, g.next)
         raises(StopIteration, it.next)
 
+        # keyword argument
+        it = itertools.groupby([0, 1, 2, 3, 4, 5], key = half_floor)
+        for x in [0, 1, 2]:
+            k, g = it.next()
+            assert k == x
+            assert list(g) == [x*2, x*2+1]
+        raises(StopIteration, it.next)
+
         # Grouping is not based on key identity
         class NeverEqual(object):
             def __eq__(self, other):



More information about the Pypy-commit mailing list