I now need a bit more help. I made this file.
Thanks, Laura
"""
I've been looking at unittest.py, and I have a few questions.
First - is this conversion table ok as far as it goes?
Second - do we ever use the msg argument, or always the None default?
Third - what about the ones I left out? what is the 'raises' syntax?
Fourth - do we ever use them without a preceeding self. ?
Fifth - what about the imports? we need to convert them too.
import unittest --> from std.utest import raises, whatelse ?
"""
# The translations needed, in ascending order of my confusion
#def assert_(self, expr, msg=None):
self.assert_(expr) --> assert expr
self.failUnless(expr) --> assert expr
#def assertEqual(self, first, second, msg=None):
self.assertEqual(left, right) --> assert left == right
self.assertEquals(left, right) --> assert left == right
self.failUnlessEqual(left, right) --> assert left == right
#def assertNotEqual(self, first, second, msg=None):
self.assertNotEqual(left, right) --> assert left != right
self.assertNotEquals(left, right) --> assert left != right
self.failIfEqual(left, right) --> assert left != right
# I don't know the precise syntax for raises
#def assertRaises(self, excClass, callableObj, *args, **kwargs):
self.assertRaises(excClass, callableObj, *args, **kwargs)
--> raises(ExpectedException, 'now what?', 'now what2?')
self.failUnlessRaises(excClass, callableObj, *args, **kwargs)
--> raises(ExpectedException, 'now what?', 'now what2?')
# I don't know if the new framework handles these at all, or their
# new names if they exist
#def fail(self, msg=None):
#def failIf(self, expr, msg=None):
#def failUnless(self, expr, msg=None):
# And I am even more clueless about what you want me to do
# about these friends.
#def failUnlessAlmostEqual(self, first, second, places=7, msg=None):
#assertAlmostEqual = assertAlmostEquals = failUnlessAlmostEqual
#def failIfAlmostEqual(self, first, second, places=7, msg=None):
#assertNotAlmostEqual = assertNotAlmostEquals = failIfAlmostEqual
_______________________________________________
[EMAIL PROTECTED]
http://codespeak.net/mailman/listinfo/pypy-dev