diff options
| author | Andriy Sokolovskiy <me@asokolovskiy.com> | 2015-06-04 15:51:07 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-06-06 09:04:53 -0400 |
| commit | 08232ef84d4959826ad5136f183c9fc5bedf0599 (patch) | |
| tree | 68a8d8808cbb558c7cecfbc5a20aa3055f7541d2 /tests | |
| parent | dee1bcd08a013ba5ffd8d1ec9b6628702f755066 (diff) | |
Fixed #24744 - Fixed relabeled_clone for the Transform
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/custom_lookups/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/custom_lookups/tests.py b/tests/custom_lookups/tests.py index 1b069047e4..dd8d431d3d 100644 --- a/tests/custom_lookups/tests.py +++ b/tests/custom_lookups/tests.py @@ -559,3 +559,18 @@ class CustomisedMethodsTests(TestCase): def test_overridden_get_transform_chain(self): q = CustomModel.objects.filter(field__transformfunc_banana__transformfunc_pear=3) self.assertIn('pear()', str(q.query)) + + +class SubqueryTransformTests(TestCase): + def test_subquery_usage(self): + models.IntegerField.register_lookup(Div3Transform) + try: + Author.objects.create(name='a1', age=1) + a2 = Author.objects.create(name='a2', age=2) + Author.objects.create(name='a3', age=3) + Author.objects.create(name='a4', age=4) + self.assertQuerysetEqual( + Author.objects.order_by('name').filter(id__in=Author.objects.filter(age__div3=2)), + [a2], lambda x: x) + finally: + models.IntegerField._unregister_lookup(Div3Transform) |
