[pypy-svn] r78556 - pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test

arigo at codespeak.net arigo at codespeak.net
Sat Oct 30 19:07:57 CEST 2010


Author: arigo
Date: Sat Oct 30 19:07:55 2010
New Revision: 78556

Modified:
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizebasic.py
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizeopt.py
Log:
Improve the printing done by equaloplists(). 


Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizebasic.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizebasic.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizebasic.py	Sat Oct 30 19:07:55 2010
@@ -129,7 +129,8 @@
 
 # ____________________________________________________________
 
-def equaloplists(oplist1, oplist2, strict_fail_args=True, remap={}):
+def equaloplists(oplist1, oplist2, strict_fail_args=True, remap={},
+                 text_right=None):
     # try to use the full width of the terminal to display the list
     # unfortunately, does not work with the default capture method of py.test
     # (which is fd), you you need to use either -s or --capture=sys, else you
@@ -137,7 +138,8 @@
     totwidth = py.io.get_terminal_width()
     width = totwidth / 2 - 1
     print ' Comparing lists '.center(totwidth, '-')
-    print '%s| %s' % ('optimized'.center(width), 'expected'.center(width))
+    text_right = text_right or 'expected'
+    print '%s| %s' % ('optimized'.center(width), text_right.center(width))
     for op1, op2 in zip(oplist1, oplist2):
         txt1 = str(op1)
         txt2 = str(op2)
@@ -167,7 +169,7 @@
                 fail_args2 = set([remap.get(y, y) for y in op2.getfailargs()])
                 assert fail_args1 == fail_args2
     assert len(oplist1) == len(oplist2)
-    print '-'*57
+    print '-'*totwidth
     return True
 
 def test_equaloplists():

Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizeopt.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizeopt.py	Sat Oct 30 19:07:55 2010
@@ -55,14 +55,14 @@
         descr.rd_snapshot = resume.Snapshot(None, _sortboxes(fail_args))
         return descr
 
-    def assert_equal(self, optimized, expected):
+    def assert_equal(self, optimized, expected, text_right=None):
         assert len(optimized.inputargs) == len(expected.inputargs)
         remap = {}
         for box1, box2 in zip(optimized.inputargs, expected.inputargs):
             assert box1.__class__ == box2.__class__
             remap[box2] = box1
         assert equaloplists(optimized.operations,
-                            expected.operations, False, remap)
+                            expected.operations, False, remap, text_right)
 
     def optimize_loop(self, ops, optops, expected_preamble=None):
         loop = self.parse(ops)
@@ -89,7 +89,8 @@
         
         self.assert_equal(loop, expected)
         if expected_preamble:
-            self.assert_equal(loop.preamble, expected_preamble)
+            self.assert_equal(loop.preamble, expected_preamble,
+                              text_right='expected preamble')
 
         return loop
 



More information about the Pypy-commit mailing list