On Sat, Oct 10, 2009 at 8:21 PM, Russell Keith-Magee <[email protected]
> wrote:
> One thought that has occurred to me is that rather than using msg as
> the complete literal error string, we could use it as a prefix to the
> literal.
>
> i.e., to take line 124 that you used as an example:
>
> > def assertFormError(self, response, form, field, errors, msg=None):
> > ...
> > self.fail(msg or "The field '%s' on form '%s' in context %d"
> > " contains no errors" % (field, form, i))
>
> would become:
>
> prefix = msg and "%s: " % msg or ""
> self.fail("%sThe field '%s' on form '%s' in context %d"
> " contains no errors" % (prefix, field, form, i))
>
> This preserves the best of both worlds - a rich failure message, plus
> the ability to add user-specific context to help identify the source
> of the problem in the test suite. This does differ from the behavior
> of the assert* functions in the standard library, but hopefully in a
> way that makes sense under the circumstances. Opinions?
>
I like this, except I'd rather give it a name other than msg since it does
act a bit differently than the msg argument taken by the Python assert*
methods.
Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---