summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2021-03-17 16:33:52 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-03-18 11:09:03 +0100
commit6b020f3c94fb7f27875d5fe21a71a5ee7c9a7538 (patch)
treea5a2eba5a6697fee76bfab193a8c113166c542fa
parent46bdc3eaf08d24d5fad3823bb75f5f47b9ede1a9 (diff)
downloaddjango-6b020f3c94fb7f27875d5fe21a71a5ee7c9a7538.tar.gz
[3.2.x] Fixed #32547 -- Corrected notes about validation in HTML assertions docs.
Backport of ceb4b9ee68dffc6ab0398886f1758f15f037c472 from main
-rw-r--r--django/test/html.py8
-rw-r--r--docs/topics/testing/tools.txt7
2 files changed, 7 insertions, 8 deletions
diff --git a/django/test/html.py b/django/test/html.py
index 486a0d358d..76ebe0d4f1 100644
--- a/django/test/html.py
+++ b/django/test/html.py
@@ -225,10 +225,10 @@ class Parser(HTMLParser):
def parse_html(html):
"""
- Take a string that contains *valid* HTML and turn it into a Python object
- structure that can be easily compared against other HTML on semantic
- equivalence. Syntactical differences like which quotation is used on
- arguments will be ignored.
+ Take a string that contains HTML and turn it into a Python object structure
+ that can be easily compared against other HTML on semantic equivalence.
+ Syntactical differences like which quotation is used on arguments will be
+ ignored.
"""
parser = Parser()
parser.feed(html)
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index 98e773fb31..84f1eabff1 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -1620,7 +1620,7 @@ your test suite.
'<input id="id_accept_terms" type="checkbox" checked>'
)
- ``html1`` and ``html2`` must be valid HTML. An ``AssertionError`` will be
+ ``html1`` and ``html2`` must contain HTML. An ``AssertionError`` will be
raised if one of them cannot be parsed.
Output in case of error can be customized with the ``msg`` argument.
@@ -1631,7 +1631,7 @@ your test suite.
comparison is based on HTML semantics. See
:meth:`~SimpleTestCase.assertHTMLEqual` for details.
- ``html1`` and ``html2`` must be valid HTML. An ``AssertionError`` will be
+ ``html1`` and ``html2`` must contain HTML. An ``AssertionError`` will be
raised if one of them cannot be parsed.
Output in case of error can be customized with the ``msg`` argument.
@@ -1666,8 +1666,7 @@ your test suite.
of ``needle`` occurrences will be strictly verified.
Whitespace in most cases is ignored, and attribute ordering is not
- significant. The passed-in arguments must be valid HTML. See
- :meth:`~SimpleTestCase.assertHTMLEqual` for more details.
+ significant. See :meth:`~SimpleTestCase.assertHTMLEqual` for more details.
.. method:: SimpleTestCase.assertJSONEqual(raw, expected_data, msg=None)