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:
-
https://docs.python.org/3/library/unittest.html#unittest.TestCase.maxDiff
-
https://github.com/python/cpython/blob/d5fc99873769f0d0d5c5d5d99059177a75a4e46e/Lib/unittest/case.py#L809-L818
--
Ticket URL: <https://code.djangoproject.com/ticket/32469>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/14027 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/32469#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/32469#comment:2>
* type: New feature => Cleanup/optimization
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/32469#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"0e4e35722a03d2e4cb0b993f9b167103928b3199" 0e4e3572]:
{{{
#!CommitTicketReference repository=""
revision="0e4e35722a03d2e4cb0b993f9b167103928b3199"
Fixed #32469 -- Made assertQuerysetEqual() respect maxDiff when
ordered=False.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32469#comment:4>