[pypy-svn] r5462 - in pypy/trunk/src/pypy/tool: . test

lac at codespeak.net lac at codespeak.net
Tue Jul 6 19:07:23 CEST 2004


Author: lac
Date: Tue Jul  6 19:07:22 2004
New Revision: 5462

Modified:
   pypy/trunk/src/pypy/tool/test/test_utestconvert.py
   pypy/trunk/src/pypy/tool/test/test_utestconvert2.py
   pypy/trunk/src/pypy/tool/utestconvert.py
Log:
Check in the tests from work so I can work on them from home.
They don't pass yet.


Modified: pypy/trunk/src/pypy/tool/test/test_utestconvert.py
==============================================================================
--- pypy/trunk/src/pypy/tool/test/test_utestconvert.py	(original)
+++ pypy/trunk/src/pypy/tool/test/test_utestconvert.py	Tue Jul  6 19:07:22 2004
@@ -349,11 +349,11 @@
             """
                           )
 
-        self.assertEquals(rewrite_utest(
+        assert rewrite_utest(
             """
             self.failIfAlmostEqual(first, second, 5, 6, 7, 'Too Many Args')
             """
-            ),
+            ) == (
             """
             self.failIfAlmostEqual(first, second, 5, 6, 7, 'Too Many Args')
             """
@@ -384,6 +384,19 @@
             expression ... will this blow up?
             """
                           )
-                              
+
+        assert rewrite_utest(
+            """
+        self.failUnless('__builtin__' in modules, "An entry for __builtin__ "
+                                                    "is not in sys.modules.")
+            """
+            ) == (
+            """
+        assert '__builtin__' in modules, ("An entry for __builtin__ "
+                                                    "is not in sys.modules.")
+            """
+                           )
+            
+               
 if __name__ == '__main__':
     unittest.main()

Modified: pypy/trunk/src/pypy/tool/test/test_utestconvert2.py
==============================================================================
--- pypy/trunk/src/pypy/tool/test/test_utestconvert2.py	(original)
+++ pypy/trunk/src/pypy/tool/test/test_utestconvert2.py	Tue Jul  6 19:07:22 2004
@@ -382,6 +382,18 @@
             expression ... will this blow up?
             """
                           )
+        
+        self.assertEquals(rewrite_utest(
+            """
+        self.failUnless('__builtin__' in modules, "An entry for __builtin__ "
+                                                    "is not in sys.modules.")
+            """
+            ),
+            """
+        assert '__builtin__' in modules, ("An entry for __builtin__ "
+                                                    "is not in sys.modules.")
+            """
+                           )
             
                               
 if __name__ == '__main__':

Modified: pypy/trunk/src/pypy/tool/utestconvert.py
==============================================================================
--- pypy/trunk/src/pypy/tool/utestconvert.py	(original)
+++ pypy/trunk/src/pypy/tool/utestconvert.py	Tue Jul  6 19:07:22 2004
@@ -11,7 +11,7 @@
 #  function.
 
 # Old Unittest Name             new name         operator  # of args
-#d['assertRaises']           = ('raises',               '', ['Any'])
+d['assertRaises']           = ('raises',               '', ['Any'])
 d['fail']                   = ('raise AssertionError', '', [0,1])
 d['assert_']                = ('assert',               '', [1,2])
 d['failIf']                 = ('assert not',           '', [1,2])
@@ -25,7 +25,7 @@
 d['failUnlessAlmostEquals'] = ('assert not round',  ' !=', [2,3,4])
 
 #  the list of synonyms
-#d['failUnlessRaises']      = d['assertRaises']
+d['failUnlessRaises']      = d['assertRaises']
 d['failUnless']            = d['assert_']
 d['assertEquals']          = d['assertEqual']
 d['assertNotEquals']       = d['assertNotEqual']
@@ -139,31 +139,22 @@
     if arglist == ['']: # there weren't any
         return indent, [], [], trailer
 
-    if len(arglist) != message_pos:
-        message = None
     else:
-        message = arglist[-1]
-        arglist = arglist[:-1]
-        if message.lstrip('\t ').startswith(linesep):
-            message = '(' + message + ')'
-            # In proper input, message is required to be a string.
-            # Thus we can assume that however the string handled its
-            # line continuations in the original unittest will also work
-            # here.  But if the line happens to break  before the quoting
-            # begins, you will need another set of parens, (or a backslash).
-
-    if arglist:
         for i in range(len(arglist)):
             try:
                 parser.expr(arglist[i].lstrip('\t '))
-                # Again we want to enclose things that happen to have
-                # a linebreak just before the new arg.
             except SyntaxError:
                 if i == 0:
                     arglist[i] = '(' + arglist[i] + ')'
                 else:
                     arglist[i] = ' (' + arglist[i] + ')'
 
+    if len(arglist) != message_pos:
+        message = None
+    else:
+        message = arglist[-1]
+        arglist = arglist[:-1]
+
     return indent, arglist, message, trailer
 
 def break_args(args, arglist):



More information about the Pypy-commit mailing list