diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-03-10 09:16:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-10 09:16:28 +0100 |
| commit | ba9a2b754452b542d3f472f0acce6f940911aced (patch) | |
| tree | 3ef805503af0ff58dedba310ae18a0b1f14c8edd /tests/lookup | |
| parent | 6f5dbe9dbe45b23b3befe4f1cd2ea13b6049ab96 (diff) | |
Refs #32508 -- Raised TypeError instead of using "assert" on unsupported operations for sliced querysets.
Diffstat (limited to 'tests/lookup')
| -rw-r--r-- | tests/lookup/tests.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py index 548f470523..28ddc13aa0 100644 --- a/tests/lookup/tests.py +++ b/tests/lookup/tests.py @@ -244,6 +244,11 @@ class LookupTests(TestCase): with self.assertRaisesMessage(ValueError, msg % field_name): Model.objects.in_bulk(field_name=field_name) + def test_in_bulk_sliced_queryset(self): + msg = "Cannot use 'limit' or 'offset' with in_bulk()." + with self.assertRaisesMessage(TypeError, msg): + Article.objects.all()[0:5].in_bulk([self.a1.id, self.a2.id]) + def test_values(self): # values() returns a list of dictionaries instead of object instances -- # and you can specify which fields you want to retrieve. |
