Opened 17 years ago
Closed 17 years ago
#7165 closed (fixed)
Include an assertNotContains for responses
Reported by: | 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)
Change History (6)
by , 17 years ago
Attachment: | assert_not_contains.diff added |
---|
comment:1 by , 17 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
Component: | Uncategorized → Unit test system |
---|
by , 17 years ago
Attachment: | assert_not_contains.2.diff added |
---|
Assertion with test and documentation.
comment:3 by , 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 , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.