mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +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
|
@ -238,6 +238,9 @@ Tests
|
|||
self.client.post("/items/1", query_params={"action": "delete"})
|
||||
await self.async_client.post("/items/1", query_params={"action": "delete"})
|
||||
|
||||
* The new :meth:`.SimpleTestCase.assertNotInHTML` assertion allows testing that
|
||||
an HTML fragment is not contained in the given HTML haystack.
|
||||
|
||||
URLs
|
||||
~~~~
|
||||
|
||||
|
|
|
@ -1905,6 +1905,16 @@ your test suite.
|
|||
|
||||
In older versions, error messages didn't contain the ``haystack``.
|
||||
|
||||
.. method:: SimpleTestCase.assertNotInHTML(needle, haystack, msg_prefix="")
|
||||
|
||||
.. versionadded:: 5.1
|
||||
|
||||
Asserts that the HTML fragment ``needle`` is *not* contained in the
|
||||
``haystack``.
|
||||
|
||||
Whitespace in most cases is ignored, and attribute ordering is not
|
||||
significant. See :meth:`~SimpleTestCase.assertHTMLEqual` for more details.
|
||||
|
||||
.. method:: SimpleTestCase.assertJSONEqual(raw, expected_data, msg=None)
|
||||
|
||||
Asserts that the JSON fragments ``raw`` and ``expected_data`` are equal.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue