summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_itercompat.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-08-09 13:03:24 -0400
committerNatalia <124304+nessita@users.noreply.github.com>2024-08-28 11:47:15 -0300
commit9a461cae3e5536cbacafa53dbd290ff68df22e67 (patch)
tree7aea2bcfc8b8fd339341aa5c7cb6143a3b99d858 /tests/utils_tests/test_itercompat.py
parentdd58edcc373afe57a56bf7c2374a4fc8446e80e9 (diff)
[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 57307bbc7d88927989cf5b314f16d6e13ade04e6 from main.
Diffstat (limited to 'tests/utils_tests/test_itercompat.py')
-rw-r--r--tests/utils_tests/test_itercompat.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/utils_tests/test_itercompat.py b/tests/utils_tests/test_itercompat.py
index e6ea278ab4..a95867c621 100644
--- a/tests/utils_tests/test_itercompat.py
+++ b/tests/utils_tests/test_itercompat.py
@@ -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__)