diff options
author | Josh Schneier <josh.schneier@gmail.com> | 2018-07-15 17:47:17 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-07-16 14:28:47 -0400 |
commit | 4d48ddd8f93800a80330ec1dee7b7d4afe6ea95a (patch) | |
tree | 1c22c51ef214939f38314ead69d96fdd0309843c /tests/pagination | |
parent | 93e721a0b8155470336357c148c4d8364c36bbee (diff) | |
download | django-4d48ddd8f93800a80330ec1dee7b7d4afe6ea95a.tar.gz |
Fixed #28917 -- Prevented Paginator's unordered warning on EmptyQuerySet.
Thanks carltongibson for the idea and weijunji for the initial patch.
Diffstat (limited to 'tests/pagination')
-rw-r--r-- | tests/pagination/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py index f13afc308f..987e713405 100644 --- a/tests/pagination/tests.py +++ b/tests/pagination/tests.py @@ -1,4 +1,5 @@ import unittest +import warnings from datetime import datetime from django.core.paginator import ( @@ -368,6 +369,11 @@ class ModelPaginationTests(TestCase): # is appropriate). self.assertEqual(cm.filename, __file__) + def test_paginating_empty_queryset_does_not_warn(self): + with warnings.catch_warnings(record=True) as recorded: + Paginator(Article.objects.none(), 5) + self.assertEqual(len(recorded), 0) + def test_paginating_unordered_object_list_raises_warning(self): """ Unordered object list warning with an object that has an orderd |