mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #34658 -- Added SimpleTestCase.assertNotInHTML().
This commit is contained in:
parent
5c6906cef4
commit
2bf46c3825
4 changed files with 37 additions and 8 deletions
|
@ -1053,6 +1053,16 @@ class InHTMLTests(SimpleTestCase):
|
|||
with self.assertRaisesMessage(AssertionError, msg):
|
||||
self.assertInHTML("<b>This</b>", haystack, 3)
|
||||
|
||||
def test_assert_not_in_html(self):
|
||||
haystack = "<p><b>Hello</b> <span>there</span>! Hi <span>there</span>!</p>"
|
||||
self.assertNotInHTML("<b>Hi</b>", haystack=haystack)
|
||||
msg = (
|
||||
"'<b>Hello</b>' unexpectedly found in the following response"
|
||||
f"\n{haystack!r}"
|
||||
)
|
||||
with self.assertRaisesMessage(AssertionError, msg):
|
||||
self.assertNotInHTML("<b>Hello</b>", haystack=haystack)
|
||||
|
||||
|
||||
class JSONEqualTests(SimpleTestCase):
|
||||
def test_simple_equal(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue