#32469: Add support for maxDiff to TransactionTestCase.assertQuerysetEqual().
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: New | Status: assigned
feature |
Component: Testing | Version: master
framework | Keywords: maxDiff,
Severity: Normal | assertQuerysetEqual
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
`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:
-
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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.46724d94f5ff6b78f12671d7508c831e%40djangoproject.com.