This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Phlip
Recipients Phlip
Date 2010-01-15.18:55:16
SpamBayes Score 3.3873823e-06
Marked as misclassified No
Message-id <1263581718.9.0.313576531416.issue7709@psf.upfronthosting.co.za>
In-reply-to
Content
The various assertions are not DRY when they force you to repeat any automatic diagnostic in a message string, if you provide it.

Here's an example:

    def assertEqual(self, first, second, msg=None):
         self.assert_((first == second), msg or '%s != %s' % (first, second))

I think it should work like this:
 
     def assertEqual(self, first, second, msg=''):
         self.assert_((first == second),
 		(msg + ('\n%s != %s' % (first, second))).strip())
 
That way, if you provide a message (such as a message describing the semantic _meaning_ why "41" should not equal "42"), the assertion does not throw away the automatically generated "41 != 42".

In the current system, to correctly reflect the 41 and 42, you must add them to the msg body. This is redundant with the assertions' primary behaviors...
History
Date User Action Args
2010-01-15 18:55:18Phlipsetrecipients: + Phlip
2010-01-15 18:55:18Phlipsetmessageid: <1263581718.9.0.313576531416.issue7709@psf.upfronthosting.co.za>
2010-01-15 18:55:17Phliplinkissue7709 messages
2010-01-15 18:55:16Phlipcreate