mirror of https://github.com/django/django.git
Refs #18414 -- Added tests for selected columns of sliced distinct querysets.
This commit is contained in:
parent
06ebaa9e28
commit
d2263b7b87
|
@ -2226,6 +2226,14 @@ class ExistsSql(TestCase):
|
|||
self.assertNotIn(id, qstr)
|
||||
self.assertNotIn(name, qstr)
|
||||
|
||||
def test_sliced_distinct_exists(self):
|
||||
with CaptureQueriesContext(connection) as captured_queries:
|
||||
self.assertIs(Article.objects.distinct()[1:3].exists(), False)
|
||||
self.assertEqual(len(captured_queries), 1)
|
||||
captured_sql = captured_queries[0]["sql"]
|
||||
self.assertIn(connection.ops.quote_name("id"), captured_sql)
|
||||
self.assertIn(connection.ops.quote_name("name"), captured_sql)
|
||||
|
||||
def test_ticket_18414(self):
|
||||
Article.objects.create(name="one", created=datetime.datetime.now())
|
||||
Article.objects.create(name="one", created=datetime.datetime.now())
|
||||
|
|
Loading…
Reference in New Issue