mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Added more tests for chaining QuerySet.defer() after only().
This commit is contained in:
parent
6a970a8b46
commit
96706d76cd
@ -49,9 +49,15 @@ class DeferTests(AssertionMixin, TestCase):
|
||||
qs = Primary.objects.all()
|
||||
self.assert_delayed(qs.only("name", "value").defer("name")[0], 2)
|
||||
self.assert_delayed(qs.defer("name").only("value", "name")[0], 2)
|
||||
self.assert_delayed(qs.defer('name').only('name').only('value')[0], 2)
|
||||
self.assert_delayed(qs.defer("name").only("value")[0], 2)
|
||||
self.assert_delayed(qs.only("name").defer("value")[0], 2)
|
||||
|
||||
def test_defer_only_clear(self):
|
||||
qs = Primary.objects.all()
|
||||
self.assert_delayed(qs.only('name').defer('name')[0], 0)
|
||||
self.assert_delayed(qs.defer('name').only('name')[0], 0)
|
||||
|
||||
def test_defer_on_an_already_deferred_field(self):
|
||||
qs = Primary.objects.all()
|
||||
self.assert_delayed(qs.defer("name")[0], 1)
|
||||
|
Loading…
Reference in New Issue
Block a user