diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2013-12-18 16:59:08 +0100 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2013-12-18 18:40:00 +0100 |
| commit | f1b3ab9c2158f5a7da113aef4158499ce2d42ee2 (patch) | |
| tree | 38fdbbafde8008a26d6ef559e25a18c69afee958 /tests | |
| parent | d34c8c338a843df2a540f19d15efc1ff12e3119c (diff) | |
Fixed #11629 -- Deprecated callable arguments to queryset methods.
Callable arguments were an untested and undocumented feature.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/queries/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
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): ['<Author: a1>', '<Author: a2>', '<Author: a3>', '<Author: a4>'] ) + 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, + ['<Tag: t1>', '<Tag: t2>', '<Tag: t3>', '<Tag: t4>', '<Tag: t5>'] + ) + self.assertEqual(len(w), 1) + self.assertTrue(issubclass(w[0].category, PendingDeprecationWarning)) + class Queries2Tests(TestCase): def setUp(self): |
