diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-07-19 13:55:32 -0700 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-07-23 20:12:08 +0200 |
commit | d89053585e11e869efcc9debb1c311b47b5e20ea (patch) | |
tree | 94c606567d2611fb47914a59800af3d9ab2da6be /tests/pagination | |
parent | 8323691de0ba120dbdc8055063574df2b0c0afa4 (diff) | |
download | django-d89053585e11e869efcc9debb1c311b47b5e20ea.tar.gz |
Improved error message when index in __getitem__() is invalid.
Diffstat (limited to 'tests/pagination')
-rw-r--r-- | tests/pagination/tests.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py index ef5108e42b..95310d26bd 100644 --- a/tests/pagination/tests.py +++ b/tests/pagination/tests.py @@ -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) |