[issue6966] Ability to refer to arguments in TestCase.fail* methods

Hari Krishna Dara report at bugs.python.org
Fri Jun 18 03:44:37 CEST 2010


Hari Krishna Dara <haridara at gmail.com> added the comment:

Oops... the dict part should have been "dict(lhs=first, rhs=second)":

    def failUnlessEqual(self, first, second, msg=None):
        """Fail if the two objects are unequal as determined by the '=='
           operator. Argument msg could optionally include string format
           operators named "lhs" and "rhs" (e.g., "%(lhs)r")
        """
        if not first == second:
            raise self.failureException, \
                  (msg or "%(lhs)r != %(rhs)r") % dict(lhs=first, rhs=second)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6966>
_______________________________________


More information about the Python-bugs-list mailing list