Opened 17 years ago

Closed 16 years ago

#7165 closed (fixed)

Include an assertNotContains for responses

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

Description

Hello,

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.

Thanks.

Attachments (2)

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

Download all attachments as: .zip

Change History (6)

by J. Pablo Fernandez <pupeno@…>, 17 years ago

Attachment: assert_not_contains.diff added

comment:1 by Russell Keith-Magee, 17 years ago

Needs documentation: set
Needs tests: set
Triage Stage: UnreviewedAccepted

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

BUT

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 by Russell Keith-Magee, 17 years ago

Component: UncategorizedUnit test system

by J. Pablo Fernandez <pupeno@…>, 17 years ago

Attachment: assert_not_contains.2.diff added

Assertion with test and documentation.

comment:3 by J. Pablo Fernandez <pupeno@…>, 17 years ago

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 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(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