[Django] #20918: Tidy up implementation of custom assertions

11 views
Skip to first unread message

Django

unread,
Aug 14, 2013, 8:38:36 AM8/14/13
to django-...@googlegroups.com
#20918: Tidy up implementation of custom assertions
--------------------------------------+--------------------
Reporter: mjtamlyn | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
The custom assertions provided by Django have a significant amount of
duplication between the true and false cases - e.g. between
`assertContains` and `assertNotContains`. There appear to be subtle
difference and it concerns me that perhaps some of these are bugfixes
which have only been applied to one of the methods.

For example, `assertNotContains` seems to not handle streaming responses.

--
Ticket URL: <https://code.djangoproject.com/ticket/20918>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 16, 2013, 3:24:15 PM8/16/13
to django-...@googlegroups.com
#20918: Tidy up implementation of custom assertions
--------------------------------------+------------------------------------

Reporter: mjtamlyn | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/20918#comment:1>

Django

unread,
Aug 22, 2013, 1:59:43 PM8/22/13
to django-...@googlegroups.com
#20918: Tidy up implementation of custom assertions
--------------------------------------+------------------------------------

Reporter: mjtamlyn | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by ersran9):

I've written an initial patch https://github.com/django/django/pull/1507 .
I'm not really sure if this is the way to go forward. If it is, then I'll
move forward with other functions that has the same problem.

--
Ticket URL: <https://code.djangoproject.com/ticket/20918#comment:2>

Django

unread,
Sep 5, 2013, 9:52:15 AM9/5/13
to django-...@googlegroups.com
#20918: Tidy up implementation of custom assertions
--------------------------------------+------------------------------------
Reporter: mjtamlyn | Owner: nobody
Type: Cleanup/optimization | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"a2374bcf476b49441793f1ad213126b07543da54"]:
{{{
#!CommitTicketReference repository=""
revision="a2374bcf476b49441793f1ad213126b07543da54"
Fixed #20918 -- Tidied up implementation of custom assertions

1. Moved common logic between assertContains and assertNotContains
into a separate function _assert_contains()

2. Moved common logic between assertTemplateUsed and
assertTemplateNotUsed into a separate function
_assert_templateused()

Thanks Marc Tamlyn for the report and review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20918#comment:3>

Reply all
Reply to author
Forward
0 new messages