Opened 4 years ago

Closed 4 years ago

Last modified 4 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


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 Changed 4 years ago by amatellanes

I started a pull request for this ticket here:

comment:2 Changed 4 years ago by loic84

Cc: loic@… added
Triage Stage: UnreviewedAccepted

Accepting on the basis of consistency with assertXMLEqual/assertXMLNotEqual.

comment:3 Changed 4 years ago by Aymeric Augustin

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 Changed 4 years ago by loic84

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 Changed 4 years ago by Aymeric Augustin

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

comment:6 Changed 4 years ago by Loic Bistuer <loic.bistuer@…>

Resolution: fixed
Status: newclosed

In 8394e570baf91cff5e5349c0ef06c4f06f06d0b1:

Fixed #22465 -- New assertion assertJSONNotEqual

comment:7 Changed 4 years ago by Tim Graham <timograham@…>

In dc7bc42cce39f8141df40d831de9befb13946fef:

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

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