1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #35728 -- Computed error messages in assertions only on test failures.

Performance regression in 1dae65dc63.

Thanks to Adam Johnson for the report.
This commit is contained in:
Clifford Gama
2025-04-18 19:55:59 +02:00
committed by Sarah Boyce
parent 04e813cd17
commit 449b9f9aee
2 changed files with 89 additions and 53 deletions

View File

@@ -1083,6 +1083,15 @@ class InHTMLTests(SimpleTestCase):
with self.assertRaisesMessage(AssertionError, msg):
self.assertNotInHTML("<b>Hello</b>", haystack=haystack)
def test_assert_not_in_html_msg_prefix(self):
haystack = "<p>Hello</p>"
msg = (
"1 != 0 : Prefix: '<p>Hello</p>' unexpectedly found in the following "
f"response\n{haystack!r}"
)
with self.assertRaisesMessage(AssertionError, msg):
self.assertNotInHTML("<p>Hello</p>", haystack=haystack, msg_prefix="Prefix")
class JSONEqualTests(SimpleTestCase):
def test_simple_equal(self):