summaryrefslogtreecommitdiff
path: root/tests/forms_tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-08-09 13:03:24 -0400
committernessita <124304+nessita@users.noreply.github.com>2024-08-28 11:44:05 -0300
commit57307bbc7d88927989cf5b314f16d6e13ade04e6 (patch)
tree2f110306223f71903fbe38a35bedeb898d38677a /tests/forms_tests
parent39abd56a7fb1e2f735040df0fdfc08f57d91a49b (diff)
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.
Diffstat (limited to 'tests/forms_tests')
-rw-r--r--tests/forms_tests/field_tests/test_urlfield.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/forms_tests/field_tests/test_urlfield.py b/tests/forms_tests/field_tests/test_urlfield.py
index 8ba7842064..54bc7c5e46 100644
--- a/tests/forms_tests/field_tests/test_urlfield.py
+++ b/tests/forms_tests/field_tests/test_urlfield.py
@@ -163,9 +163,10 @@ class URLFieldAssumeSchemeDeprecationTest(FormFieldAssertionsMixin, SimpleTestCa
"or set the FORMS_URLFIELD_ASSUME_HTTPS transitional setting to True to "
"opt into using 'https' as the new default scheme."
)
- with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
+ with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
f = URLField()
self.assertEqual(f.clean("example.com"), "http://example.com")
+ self.assertEqual(ctx.filename, __file__)
@ignore_warnings(category=RemovedInDjango60Warning)
def test_urlfield_forms_urlfield_assume_https(self):