mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Improved error message when index in __getitem__() is invalid.
This commit is contained in:
parent
8323691de0
commit
d89053585e
6 changed files with 28 additions and 4 deletions
|
@ -366,7 +366,8 @@ class ModelPaginationTests(TestCase):
|
|||
# Make sure object_list queryset is not evaluated by an invalid __getitem__ call.
|
||||
# (this happens from the template engine when using eg: {% page_obj.has_previous %})
|
||||
self.assertIsNone(p.object_list._result_cache)
|
||||
with self.assertRaises(TypeError):
|
||||
msg = 'Page indices must be integers or slices, not str.'
|
||||
with self.assertRaisesMessage(TypeError, msg):
|
||||
p['has_previous']
|
||||
self.assertIsNone(p.object_list._result_cache)
|
||||
self.assertNotIsInstance(p.object_list, list)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue