MCPcopy
hub / github.com/django/django / test_base

Method test_base

tests/test_utils/tests.py:1102–1116  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1100 )
1101
1102 def test_base(self):
1103 haystack = "<p><b>Hello</b> <span>there</span>! Hi <span>there</span>!</p>"
1104
1105 self.assertInHTML("<b>Hello</b>", haystack=haystack)
1106 msg = f"Couldn't find '<p>Howdy</p>' in the following response\n{haystack!r}"
1107 with self.assertRaisesMessage(AssertionError, msg):
1108 self.assertInHTML("<p>Howdy</p>", haystack)
1109
1110 self.assertInHTML("<span>there</span>", haystack=haystack, count=2)
1111 msg = (
1112 "Found 1 instances of '<b>Hello</b>' (expected 2) in the following response"
1113 f"\n{haystack!r}"
1114 )
1115 with self.assertRaisesMessage(AssertionError, msg):
1116 self.assertInHTML("<b>Hello</b>", haystack=haystack, count=2)
1117
1118 def test_long_haystack(self):
1119 haystack = (

Callers

nothing calls this directly

Calls 2

assertInHTMLMethod · 0.80
assertRaisesMessageMethod · 0.80

Tested by

no test coverage detected