diff options
| author | Tim Graham <timograham@gmail.com> | 2015-08-15 19:05:42 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-09-04 07:44:36 -0400 |
| commit | 233b46f93171d4a7cc279bc3f35e5a99e9a167b8 (patch) | |
| tree | 2fffde49fc52226c30f726a4942585656506655c /tests | |
| parent | 7c0850028f25eebaa9b521b5d02afac084ff2c6f (diff) | |
Fixed #19263 -- Fixed crash when filtering using __in and an empty QuerySet.
Thanks Marcin Biernat for the initial patch and tests.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/queries/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 831990f099..c9919dce44 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -2362,6 +2362,9 @@ class WeirdQuerysetSlicingTests(BaseQuerysetTest): Article.objects.create(name='three', created=datetime.datetime.now()) Article.objects.create(name='four', created=datetime.datetime.now()) + food = Food.objects.create(name='spam') + Eaten.objects.create(meal='spam with eggs', food=food) + def test_tickets_7698_10202(self): # People like to slice with '0' as the high-water mark. self.assertQuerysetEqual(Article.objects.all()[0:0], []) @@ -2377,6 +2380,12 @@ class WeirdQuerysetSlicingTests(BaseQuerysetTest): # ticket #12192 self.assertNumQueries(0, lambda: list(Number.objects.all()[1:1])) + def test_empty_sliced_subquery(self): + self.assertEqual(Eaten.objects.filter(food__in=Food.objects.all()[0:0]).count(), 0) + + def test_empty_sliced_subquery_exclude(self): + self.assertEqual(Eaten.objects.exclude(food__in=Food.objects.all()[0:0]).count(), 1) + class EscapingTests(TestCase): def test_ticket_7302(self): |
