Fixed #19462 -- Made assertQuerysetEqual detect undefined ordering

If there are more than one values to compare against and the qs isn't
ordered then assertQuerysetEqual will raise a ValueError.
This commit is contained in:
Anssi Kääriäinen 2012-12-13 13:33:11 +02:00
parent 6ed6a18a03
commit 088d3bc2f8
19 changed files with 171 additions and 68 deletions

View file

@ -23,6 +23,11 @@ Minor features
* Authentication backends can raise ``PermissionDenied`` to immediately fail
the authentication chain.
* The ``assertQuerysetEqual()`` now checks for undefined order and raises
``ValueError`` if undefined order is spotted. The order is seen as
undefined if the given ``QuerySet`` isn't ordered and there are more than
one ordered values to compare against.
Backwards incompatible changes in 1.6
=====================================

View file

@ -1770,6 +1770,11 @@ your test suite.
via an explicit ``order_by()`` call on the queryset prior to
comparison.
.. versionchanged:: 1.6
The method now checks for undefined order and raises ``ValueError``
if undefined order is spotted. The ordering is seen as undefined if
the given ``qs`` isn't ordered and the comparison is against more
than one ordered values.
.. method:: TestCase.assertNumQueries(num, func, *args, **kwargs)