Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#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 amatellanes, 11 years ago

I started a pull request for this ticket here: https://github.com/django/django/pull/2579

comment:2 by loic84, 11 years ago

Cc: loic@… added
Triage Stage: UnreviewedAccepted

Accepting on the basis of consistency with assertXMLEqual/assertXMLNotEqual.

comment:3 by Aymeric Augustin, 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 loic84, 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 Aymeric Augustin, 11 years ago

Oops, sorry, I missed we already had it. Yes, let's add the negative assertion then.

comment:6 by Loic Bistuer <loic.bistuer@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 8394e570baf91cff5e5349c0ef06c4f06f06d0b1:

Fixed #22465 -- New assertion assertJSONNotEqual

comment:7 by Tim Graham <timograham@…>, 11 years ago

In dc7bc42cce39f8141df40d831de9befb13946fef:

Added missing versionadded annotation and tweaked release note; refs #22465.

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