@step(CHECK_PREFIX<EOL>+ r'<STR_LIT>')<EOL>def mail_sent_contains_html(self):
for email in mail.outbox:<EOL><INDENT>try:<EOL><INDENT>html = next(content for content, mime in email.alternatives<EOL>if mime == '<STR_LIT>')<EOL>dom1 = parse_html(html)<EOL>dom2 = parse_html(self.multiline)<EOL>assert_in(dom1, dom2)<EOL><DEDENT>except AssertionError as exc:<EOL><INDENT>print("<STR_LIT>", exc)<EOL>continue<EOL><DEDENT>return True<EOL><DEDENT>raise AssertionError("<STR_LIT>")<EOL>
Test that an email contains the HTML (assert HTML in) in the multiline as
one of its MIME alternatives.

The HTML is normalised by passing through Django's
:func:`django.test.html.parse_html`.

Example:

.. code-block:: gherkin

    And I have sent an email with the following HTML alternative:
    \"\"\"
    <p><strong>Name:</strong> Sir Panda</p>
    <p><strong>Phone:</strong> 0400000000</p>
    <p><strong>Email:</strong> sir.panda@pand.as</p>
    \"\"\"