mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
[5.1.x] Fixed #35666 -- Documented stacklevel usage and testing, and adjusted test suite accordingly.
Over the years we've had multiple instances of hit and misses when
emitting warnings: either setting the wrong stacklevel or not setting
it at all.
This work adds assertions for the existing warnings that were declaring
the correct stacklevel, but were lacking tests for it.
Backport of 57307bbc7d from main.
This commit is contained in:
@@ -11,5 +11,6 @@ class TestIterCompat(SimpleTestCase):
|
||||
"django.utils.itercompat.is_iterable() is deprecated. "
|
||||
"Use isinstance(..., collections.abc.Iterable) instead."
|
||||
)
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
|
||||
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
|
||||
is_iterable([])
|
||||
self.assertEqual(ctx.filename, __file__)
|
||||
|
||||
Reference in New Issue
Block a user