mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Added assertXML[Not]Equal assertions
This is especially needed to compare XML when hash randomization is on, as attribute order may vary. Refs #17758, #19038. Thanks Taylor Mitchell for the initial patch, and Ian Clelland for review and cleanup.
This commit is contained in:
parent
6d46c740d8
commit
117e99511e
5 changed files with 186 additions and 89 deletions
|
@ -1783,6 +1783,25 @@ your test suite.
|
|||
``html1`` and ``html2`` must be valid HTML. An ``AssertionError`` will be
|
||||
raised if one of them cannot be parsed.
|
||||
|
||||
.. method:: SimpleTestCase.assertXMLEqual(xml1, xml2, msg=None)
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
Asserts that the strings ``xml1`` and ``xml2`` are equal. The
|
||||
comparison is based on XML semantics. Similarily to
|
||||
:meth:`~SimpleTestCase.assertHTMLEqual`, the comparison is
|
||||
made on parsed content, hence only semantic differences are considered, not
|
||||
syntax differences. When unvalid XML is passed in any parameter, an
|
||||
``AssertionError`` is always raised, even if both string are identical.
|
||||
|
||||
.. method:: SimpleTestCase.assertXMLNotEqual(xml1, xml2, msg=None)
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
Asserts that the strings ``xml1`` and ``xml2`` are *not* equal. The
|
||||
comparison is based on XML semantics. See
|
||||
:meth:`~SimpleTestCase.assertXMLEqual` for details.
|
||||
|
||||
.. _topics-testing-email:
|
||||
|
||||
Email services
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue