|
@@ -1,5 +1,6 @@
|
|
|
import collections.abc
|
|
|
import inspect
|
|
|
+import pathlib
|
|
|
import unittest.mock
|
|
|
import warnings
|
|
|
from datetime import datetime
|
|
@@ -888,7 +889,11 @@ class ModelPaginationTests(TestCase):
|
|
|
AsyncPaginator(Article.objects.all(), 5)
|
|
|
# The warning points at the BasePaginator caller.
|
|
|
# The reason is that the UnorderedObjectListWarning occurs in BasePaginator.
|
|
|
- self.assertEqual(cm.filename, inspect.getfile(BasePaginator))
|
|
|
+ base_paginator_path = pathlib.Path(inspect.getfile(BasePaginator))
|
|
|
+ self.assertIn(
|
|
|
+ cm.filename,
|
|
|
+ [str(base_paginator_path), str(base_paginator_path.with_suffix(".py"))],
|
|
|
+ )
|
|
|
|
|
|
def test_paginating_empty_queryset_does_not_warn(self):
|
|
|
with warnings.catch_warnings(record=True) as recorded:
|