#22465 closed New feature (fixed)
New assertion assertJSONNotEqual.
Reported by: | amatellanes | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.6 |
Severity: | Normal | Keywords: | test |
Cc: | loic@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There are assertions that check the equality and inequality of HTML and XML code. Likewise, a method which allow to test that two JSON fragments are not equal should be useful.
Change History (7)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Cc: | added |
---|---|
Triage Stage: | Unreviewed → Accepted |
Accepting on the basis of consistency with assertXMLEqual/assertXMLNotEqual
.
comment:3 by , 11 years ago
I'm not convinced by this argument, comparing XML for equality is a hard problem, while comparing JSON is just asserting that json.loads of both args is equal.
In practice I would expect most tests to assert that json.loads of something is equal to some Python structure.
comment:4 by , 11 years ago
I agree and I was surprised that we even have assertJSONEqual()
, but since we have it, I find it confusing to have one but not its reverse. Personally I've come to rely on the symmetry assertX
, assertNotX
.
What do you think?
comment:5 by , 11 years ago
Oops, sorry, I missed we already had it. Yes, let's add the negative assertion then.
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I started a pull request for this ticket here: https://github.com/django/django/pull/2579