[pypy-svn] r56500 - pypy/dist/pypy/module/itertools/test

jlg at codespeak.net jlg at codespeak.net
Sat Jul 12 16:25:11 CEST 2008


Author: jlg
Date: Sat Jul 12 16:25:09 2008
New Revision: 56500

Modified:
   pypy/dist/pypy/module/itertools/test/test_itertools.py
Log:
inter_itertools - groupby tests for wring arguments

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	Sat Jul 12 16:25:09 2008
@@ -245,7 +245,7 @@
         raises(StopIteration, it.next)
 
     def test_chain_wrongargs(self):
-        import itertools, re
+        import itertools
         
         raises(TypeError, itertools.chain, None)
         raises(TypeError, itertools.chain, [], None)
@@ -256,7 +256,7 @@
             try:
                 itertools.chain(*args)
             except TypeError, e:
-                assert re.search(r'\b%d\b' % (x + 1), str(e))
+                assert str(e).find("#" + str(x + 1) + " ") >= 0
             else:
                 fail("TypeError expected")
 
@@ -344,7 +344,7 @@
             try:
                 itertools.izip(*args)
             except TypeError, e:
-                assert re.search(r'\b%d\b' % (x + 1), str(e))
+                assert str(e).find("#" + str(x + 1) + " ") >= 0
             else:
                 fail("TypeError expected")
 
@@ -497,6 +497,13 @@
         raises(StopIteration, g.next)
         raises(StopIteration, it.next)
 
+    def test_groupby_wrongargs(self):
+        import itertools
+
+        raises(TypeError, itertools.groupby, 0)
+        it = itertools.groupby([0], 1)
+        raises(TypeError, it.next)
+
     def test_iterables(self):
         import itertools
     



More information about the Pypy-commit mailing list