Loading django/test/testcases.py +6 −0 Original line number Diff line number Diff line Loading @@ -767,6 +767,12 @@ class TransactionTestCase(SimpleTestCase): items = six.moves.map(transform, qs) if not ordered: return self.assertEqual(set(items), set(values)) values = list(values) # For example qs.iterator() could be passed as qs, but it does not # have 'ordered' attribute. if len(values) > 1 and hasattr(qs, 'ordered') and not qs.ordered: raise ValueError("Trying to compare non-ordered queryset " "against more than one ordered values") return self.assertEqual(list(items), values) def assertNumQueries(self, num, func=None, *args, **kwargs): Loading docs/releases/1.6.txt +5 −0 Original line number Diff line number Diff line Loading @@ -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 ===================================== Loading docs/topics/testing.txt +5 −0 Original line number Diff line number Diff line Loading @@ -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) Loading tests/modeltests/expressions/tests.py +3 −1 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ class ExpressionsTests(TestCase): "Max Mustermann", ], lambda c: six.text_type(c.point_of_contact), ordered=False ) c = Company.objects.all()[0] Loading @@ -170,7 +171,8 @@ class ExpressionsTests(TestCase): "Foobar Ltd.", "Test GmbH", ], lambda c: c.name lambda c: c.name, ordered=False ) Company.objects.exclude( Loading tests/modeltests/field_subclassing/tests.py +2 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,8 @@ class CustomField(TestCase): "12", "23", ], lambda m: str(m.data) lambda m: str(m.data), ordered=False ) def test_field_subclassing(self): Loading Loading
django/test/testcases.py +6 −0 Original line number Diff line number Diff line Loading @@ -767,6 +767,12 @@ class TransactionTestCase(SimpleTestCase): items = six.moves.map(transform, qs) if not ordered: return self.assertEqual(set(items), set(values)) values = list(values) # For example qs.iterator() could be passed as qs, but it does not # have 'ordered' attribute. if len(values) > 1 and hasattr(qs, 'ordered') and not qs.ordered: raise ValueError("Trying to compare non-ordered queryset " "against more than one ordered values") return self.assertEqual(list(items), values) def assertNumQueries(self, num, func=None, *args, **kwargs): Loading
docs/releases/1.6.txt +5 −0 Original line number Diff line number Diff line Loading @@ -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 ===================================== Loading
docs/topics/testing.txt +5 −0 Original line number Diff line number Diff line Loading @@ -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) Loading
tests/modeltests/expressions/tests.py +3 −1 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ class ExpressionsTests(TestCase): "Max Mustermann", ], lambda c: six.text_type(c.point_of_contact), ordered=False ) c = Company.objects.all()[0] Loading @@ -170,7 +171,8 @@ class ExpressionsTests(TestCase): "Foobar Ltd.", "Test GmbH", ], lambda c: c.name lambda c: c.name, ordered=False ) Company.objects.exclude( Loading
tests/modeltests/field_subclassing/tests.py +2 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,8 @@ class CustomField(TestCase): "12", "23", ], lambda m: str(m.data) lambda m: str(m.data), ordered=False ) def test_field_subclassing(self): Loading