[pypy-svn] r70846 - in pypy/branch/lazy-operr-format/pypy/objspace: . test

arigo at codespeak.net arigo at codespeak.net
Mon Jan 25 18:51:18 CET 2010


Author: arigo
Date: Mon Jan 25 18:51:17 2010
New Revision: 70846

Modified:
   pypy/branch/lazy-operr-format/pypy/objspace/descroperation.py
   pypy/branch/lazy-operr-format/pypy/objspace/test/test_descroperation.py
Log:
Test and fix.


Modified: pypy/branch/lazy-operr-format/pypy/objspace/descroperation.py
==============================================================================
--- pypy/branch/lazy-operr-format/pypy/objspace/descroperation.py	(original)
+++ pypy/branch/lazy-operr-format/pypy/objspace/descroperation.py	Mon Jan 25 18:51:17 2010
@@ -574,7 +574,8 @@
 
 def _make_binop_impl(symbol, specialnames):
     left, right = specialnames
-    errormsg = "unsupported operand type(s) for %s: '%%s' and '%%s'" % symbol
+    errormsg = "unsupported operand type(s) for %s: '%%s' and '%%s'" % (
+        symbol.replace('%', '%%'),)
 
     def binop_impl(space, w_obj1, w_obj2):
         w_typ1 = space.type(w_obj1)

Modified: pypy/branch/lazy-operr-format/pypy/objspace/test/test_descroperation.py
==============================================================================
--- pypy/branch/lazy-operr-format/pypy/objspace/test/test_descroperation.py	(original)
+++ pypy/branch/lazy-operr-format/pypy/objspace/test/test_descroperation.py	Mon Jan 25 18:51:17 2010
@@ -371,5 +371,14 @@
         A() < B()
         assert l == [B, A, A, B]
 
+    def test_mod_failure(self):
+        try:
+            [] % 3
+        except TypeError, e:
+            assert '%' in str(e)
+        else:
+            assert False, "did not raise"
+
+
 class AppTestWithBuiltinShortcut(AppTest_Descroperation):
     OPTIONS = {'objspace.std.builtinshortcut': True}



More information about the Pypy-commit mailing list