diff options
| author | Clifford Gama <cliffygamy@gmail.com> | 2025-04-18 19:55:59 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-07-18 10:16:59 +0200 |
| commit | 449b9f9aeeaa3a1529d2c29a9a43e87350177559 (patch) | |
| tree | aaac97e00a8177a1d59beb63219974bd99c34630 /tests/test_utils | |
| parent | 04e813cd17484ba91e3fc25d5e5118ac25f47352 (diff) | |
Fixed #35728 -- Computed error messages in assertions only on test failures.
Performance regression in 1dae65dc63ae84be5002c37b4ddae0b9220e8808.
Thanks to Adam Johnson for the report.
Diffstat (limited to 'tests/test_utils')
| -rw-r--r-- | tests/test_utils/tests.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index 494a0ea8d3..37e87aa102 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -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): |
