MCPcopy Index your code
hub / github.com/django/django / test_long_haystack

Method test_long_haystack

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

Source from the content-addressed store, hash-verified

1116 self.assertInHTML("<b>Hello</b>", haystack=haystack, count=2)
1117
1118 def test_long_haystack(self):
1119 haystack = (
1120 "<p>This is a very very very very very very very very long message which "
1121 "exceeds the max limit of truncation.</p>"
1122 )
1123 msg = f"Couldn't find '<b>Hello</b>' in the following response\n{haystack!r}"
1124 with self.assertRaisesMessage(AssertionError, msg):
1125 self.assertInHTML("<b>Hello</b>", haystack)
1126
1127 msg = (
1128 "Found 0 instances of '<b>This</b>' (expected 3) in the following response"
1129 f"\n{haystack!r}"
1130 )
1131 with self.assertRaisesMessage(AssertionError, msg):
1132 self.assertInHTML("<b>This</b>", haystack, 3)
1133
1134 def test_assert_not_in_html(self):
1135 haystack = "<p><b>Hello</b> <span>there</span>! Hi <span>there</span>!</p>"

Callers

nothing calls this directly

Calls 2

assertRaisesMessageMethod · 0.80
assertInHTMLMethod · 0.80

Tested by

no test coverage detected