1
0
mirror of https://github.com/django/django.git synced 2025-03-24 00:00:45 +00:00

Refs #35945 -- Fixed test_paginating_unordered_queryset_raises_warning_async() test on byte-compiled Django.

This commit is contained in:
Mariusz Felisiak 2025-03-13 11:06:44 +01:00 committed by GitHub
parent e03440291b
commit e7a9d756ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: