mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #28917 -- Prevented Paginator's unordered warning on EmptyQuerySet.
Thanks carltongibson for the idea and weijunji for the initial patch.
This commit is contained in:
parent
93e721a0b8
commit
4d48ddd8f9
3 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue