From f1b3ab9c2158f5a7da113aef4158499ce2d42ee2 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Wed, 18 Dec 2013 16:59:08 +0100 Subject: Fixed #11629 -- Deprecated callable arguments to queryset methods. Callable arguments were an untested and undocumented feature. --- tests/queries/tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 02c7b33480..338ec06921 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -5,6 +5,7 @@ import datetime from operator import attrgetter import pickle import unittest +import warnings from django.core.exceptions import FieldError from django.db import DatabaseError, connection, connections, DEFAULT_DB_ALIAS @@ -1139,6 +1140,17 @@ class Queries1Tests(BaseQuerysetTest): ['', '', '', ''] ) + def test_callable_args(self): + with warnings.catch_warnings(record=True) as w: + warnings.simplefilter('always') + qs = Tag.objects.filter(name__startswith=lambda: 't') + self.assertQuerysetEqual( + qs, + ['', '', '', '', ''] + ) + self.assertEqual(len(w), 1) + self.assertTrue(issubclass(w[0].category, PendingDeprecationWarning)) + class Queries2Tests(TestCase): def setUp(self): -- cgit v1.3