summaryrefslogtreecommitdiff
path: root/tests/lookup
diff options
context:
space:
mode:
authorJohn Parton <john.parton.iv@gmail.com>2024-08-18 21:52:58 -0500
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-09-02 15:04:52 +0200
commite4a2e22ddbf1b892144b35dc21404c164bc848c6 (patch)
treefb90197b283a67917a26b868c5fdb43e57e14a20 /tests/lookup
parentfd1dd767783b5a7ec1a594fcc5885e7e4178dd26 (diff)
Fixed #35690 -- Errored nicely when using in_bulk() with a values() or values_list() queryset.
Diffstat (limited to 'tests/lookup')
-rw-r--r--tests/lookup/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py
index 28acd72874..68adbe6496 100644
--- a/tests/lookup/tests.py
+++ b/tests/lookup/tests.py
@@ -327,6 +327,13 @@ class LookupTests(TestCase):
with self.assertRaisesMessage(TypeError, msg):
Article.objects.all()[0:5].in_bulk([self.a1.id, self.a2.id])
+ def test_in_bulk_not_model_iterable(self):
+ msg = "in_bulk() cannot be used with values() or values_list()."
+ with self.assertRaisesMessage(TypeError, msg):
+ Author.objects.values().in_bulk()
+ with self.assertRaisesMessage(TypeError, msg):
+ Author.objects.values_list().in_bulk()
+
def test_values(self):
# values() returns a list of dictionaries instead of object instances --
# and you can specify which fields you want to retrieve.