summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHonza Král <Honza.Kral@gmail.com>2013-02-23 15:05:24 -0800
committerHonza Král <Honza.Kral@gmail.com>2013-02-23 15:05:24 -0800
commitfc38d6a92be8baec1d02fbdf95e56c4204b9425b (patch)
tree15de6144c4d7c03e9a69f819f06382ba998885f2 /tests
parent692902b227b4aff8a4ec66fa8d4ac2d3128bcac0 (diff)
parent2b76f19f2b89ac96bae2a169d71b23553c8101c7 (diff)
Merge pull request #813 from HiddenData/ticket-19263
fixes #19263 - EmptyResultSet in subquery causes incorrect SQL
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/queries/tests.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/queries/tests.py b/tests/regressiontests/queries/tests.py
index 82a8de08be..c241c81fab 100644
--- a/tests/regressiontests/queries/tests.py
+++ b/tests/regressiontests/queries/tests.py
@@ -2021,6 +2021,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], [])
@@ -2036,6 +2039,18 @@ class WeirdQuerysetSlicingTests(BaseQuerysetTest):
# ticket #12192
self.assertNumQueries(0, lambda: list(Number.objects.all()[1:1]))
+ def test_empty_sliced_subquery(self):
+ # ticket #19263 - testing subqueries
+ self.assertEqual(
+ Eaten.objects.filter(food__in=Food.objects.all()[0:0]).count(),
+ 0)
+
+ def test_empty_sliced_subquery_exclude(self):
+ # ticket #19263 - testing subqueries
+ self.assertEqual(
+ Eaten.objects.exclude(food__in=Food.objects.all()[0:0]).count(),
+ 1)
+
class EscapingTests(TestCase):
def test_ticket_7302(self):