#5333: add an assertContext method to Django's TestCase
-----------------------+----------------------------------------------------
   Reporter:  gwilson  |                Owner:  adrian                
     Status:  new      |            Component:  Unit test system      
    Version:  SVN      |           Resolution:                        
   Keywords:           |                Stage:  Design decision needed
  Has_patch:  1        |           Needs_docs:  1                     
Needs_tests:  0        |   Needs_better_patch:  0                     
-----------------------+----------------------------------------------------
Comment (by russellm):

 My hesitation here (and the reason I didn't include a 'context assert' in
 the first place) is that assertContext does an Equals test, but doesn't
 provide a way to do any other assertion - NotEquals, True, False,
 LessThan, etc. We could get around this by adding assertContextEquals,
 assertContextNotEquals, and so on, but that is really just duplicating the
 underlying assertion API. This is certainly possible, but I'm not
 convinced it is the best approach.
 
 An alternate approach would be to provide a utility function to get the
 value of a context variable from the list of contexts in a response. This
 would allow the use of all the standard assert methods. However, I'm not
 entirely sure where such a utility function should go. Putting it on the
 TestCase itself rubs me the wrong way.
 
 I'm open to suggestions (or to comments that I'm just round-the-twist
 crazy).
 
 For future reference, some feedback on the patch itself:
  1. The test cases should check the multiple-context case, not just the
 single-context case
  1. If possible, it would also be good to provide the 'trailing space'
 parts of the patch separately to the new assertion+tests. As is, there is
 a lot of noise in the patch from all the whitespace stripping changes,
 which is an impediment to the immediate understanding of the patch.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5333#comment:3>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to