MCPcopy
hub / github.com/django/django / assertNotContains

Method assertNotContains

django/test/testcases.py:630–647  ·  view source on GitHub ↗

Assert that a response indicates that some content was retrieved successfully, (i.e., the HTTP status code was as expected) and that ``text`` doesn't occur in the content of the response.

(
        self, response, text, status_code=200, msg_prefix="", html=False
    )

Source from the content-addressed store, hash-verified

628 self.fail(msg)
629
630 def assertNotContains(
631 self, response, text, status_code=200, msg_prefix="", html=False
632 ):
633 """
634 Assert that a response indicates that some content was retrieved
635 successfully, (i.e., the HTTP status code was as expected) and that
636 ``text`` doesn't occur in the content of the response.
637 """
638 real_count, msg_prefix, response_content = self._assert_contains(
639 response, text, status_code, msg_prefix, html
640 )
641
642 if real_count != 0:
643 text_repr = self._text_repr(text, force_string=html)
644 self.fail(
645 f"{real_count} != 0 :{msg_prefix}{text_repr} unexpectedly found in the "
646 f"following response\n{response_content!r}"
647 )
648
649 def _check_test_client_response(self, response, attribute, method_name):
650 """

Calls 2

_assert_containsMethod · 0.95
_text_reprMethod · 0.95

Tested by

no test coverage detected