[3.2.x] Fixed #32547 -- Corrected notes about validation in HTML assertions docs.

Backport of ceb4b9ee68 from main
This commit is contained in:
Hasan Ramezani 2021-03-17 16:33:52 +01:00 committed by Mariusz Felisiak
parent 46bdc3eaf0
commit 6b020f3c94
2 changed files with 7 additions and 8 deletions

View File

@ -225,10 +225,10 @@ class Parser(HTMLParser):
def parse_html(html): def parse_html(html):
""" """
Take a string that contains *valid* HTML and turn it into a Python object Take a string that contains HTML and turn it into a Python object structure
structure that can be easily compared against other HTML on semantic that can be easily compared against other HTML on semantic equivalence.
equivalence. Syntactical differences like which quotation is used on Syntactical differences like which quotation is used on arguments will be
arguments will be ignored. ignored.
""" """
parser = Parser() parser = Parser()
parser.feed(html) parser.feed(html)

View File

@ -1620,7 +1620,7 @@ your test suite.
'<input id="id_accept_terms" type="checkbox" checked>' '<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. raised if one of them cannot be parsed.
Output in case of error can be customized with the ``msg`` argument. 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 comparison is based on HTML semantics. See
:meth:`~SimpleTestCase.assertHTMLEqual` for details. :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. raised if one of them cannot be parsed.
Output in case of error can be customized with the ``msg`` argument. 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. of ``needle`` occurrences will be strictly verified.
Whitespace in most cases is ignored, and attribute ordering is not Whitespace in most cases is ignored, and attribute ordering is not
significant. The passed-in arguments must be valid HTML. See significant. See :meth:`~SimpleTestCase.assertHTMLEqual` for more details.
:meth:`~SimpleTestCase.assertHTMLEqual` for more details.
.. method:: SimpleTestCase.assertJSONEqual(raw, expected_data, msg=None) .. method:: SimpleTestCase.assertJSONEqual(raw, expected_data, msg=None)