Opened 8 years ago

Closed 7 years ago

#7165 closed (fixed)

Include an assertNotContains for responses

Reported by: pupeno@… Owned by: nobody
Component: Testing framework Version: master
Severity: Keywords: test
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:



I've wrote an assertNotContains for the TestCase for testing that something is not present in the output in a response. Essentially the reverse of assertContains. The patch will be attached.


Attachments (2)

assert_not_contains.diff (1.0 KB) - added by J. Pablo Fernandez <pupeno@…> 8 years ago.
assert_not_contains.2.diff (2.4 KB) - added by J. Pablo Fernandez <pupeno@…> 8 years ago.
Assertion with test and documentation.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by J. Pablo Fernandez <pupeno@…>

comment:1 Changed 8 years ago by russellm

  • Needs documentation set
  • Needs tests set
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

You could already do this with assertContains(count=0), but I don't have any particular objection otherwise.


Needs tests and documentation. Remember people, a patch is almost worthless if it doesn't prove to me that it works, and tells me how to use it.

comment:2 Changed 8 years ago by russellm

  • Component changed from Uncategorized to Unit test system

Changed 8 years ago by J. Pablo Fernandez <pupeno@…>

Assertion with test and documentation.

comment:3 Changed 8 years ago by J. Pablo Fernandez <pupeno@…>

There it is with test and documentation. I wanted to check that the code was acceptable before putting more time on it. If you need more tests or a different documentation, let me know and I'll try to do it.

I actually haven't thought about count=0 because I almost never use count, but even then I think using NotContains() is more readable than Contains(count=0), and tests can always use some improvements in readability. Also I was thinking if maybe this has to be thin wrapper to Contains(count=0), but then, the error message would not be as informative. What do you think?

comment:4 Changed 7 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [7578]) Fixed #7165 -- Added an assertNotContains() method to the test client. Thanks for the suggestion and implementation, J. Pablo Fernandez <pupeno@…>.

Note: See TracTickets for help on using tickets.
Back to Top