Opened 4 years ago

Closed 4 years ago

#32469 closed Cleanup/optimization (fixed)

Add support for maxDiff to TransactionTestCase.assertQuerysetEqual().

Reported by: Nick Pope Owned by: Nick Pope
Component: Testing framework Version: dev
Severity: Normal Keywords: maxDiff, assertQuerysetEqual
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

TransactionTestCase.assertQuerysetEqual() does not respect maxDiff when ordered=False.

So it turns out that although assertQuerySet() with ordered=False compares two instances of collection.Counter() - a subclass of dict - calling assertEqual() will not defer to assertDictEqual() and so maxDiff isn't supported. We should use assertDictEqual() explicitly.

See the following links for details:

Change History (4)

comment:1 by Nick Pope, 4 years ago

Has patch: set

comment:2 by Jacob Walls, 4 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Mariusz Felisiak, 4 years ago

Triage Stage: AcceptedReady for checkin
Type: New featureCleanup/optimization

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 0e4e3572:

Fixed #32469 -- Made assertQuerysetEqual() respect maxDiff when ordered=False.

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