def assert_escape_and_format(inp, exp_escape=None, exp_format=None): if exp_escape is None: exp_escape = str(inp) if exp_format is None: exp_format = exp_escape exp_format = '<p>%s</p>' % exp_format.replace('\n', ' ') escape = html_escape(inp) format = html_format(inp) assert_equals(escape, exp_escape, 'ESCAPE:\n%r =!\n%r' % (escape, exp_escape), values=False) assert_equals(format, exp_format, 'FORMAT:\n%r =!\n%r' % (format, exp_format), values=False)
def assert_escape(inp, exp=None): exp = exp if exp is not None else inp assert_equals(html_escape(inp), exp)
def assert_escape(inp, exp=None): exp = exp if exp is not None else inp assert_equal(html_escape(inp), exp)