def assert_contains(self, text, num=None):
__tracebackhide__ = True  <EOL>count = self.html.count(text)<EOL>if num is None:<EOL><INDENT>assert count > <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>assert count == num<EOL><DEDENT>return self<EOL>
Assert that the generated HTML contains some text.

If ``num`` is given then the number of occurrences of ``text``
in the generated HTML must match ``num``.