'Test _check_mako_file_is_safe in html context provides appropriate violations'

@data({'expression': '${x}', 'rule': None}, {'expression': '${{unbalanced}', 'rule': Rules.mako_unparseable_expression}, {'expression': '${x    |    n}', 'rule': Rules.mako_invalid_html_filter}, {'expression': '${x    |    n,    decode.utf8}', 'rule': None}, {'expression': '${x    |    h}', 'rule': Rules.mako_unwanted_html_filter}, {'expression': '        ##    ${commented_out    |    h}', 'rule': None}, {'expression': '${x    |    n,    dump_js_escaped_json}', 'rule': Rules.mako_invalid_html_filter})
def test_check_mako_expressions_in_html(self, data):

    linter = MakoTemplateLinter()
    results = FileResults('')
    mako_template = textwrap.dedent('\n                                                <%page    expression_filter="h"/>\n                                                {expression}\n                                '.format(expression=data['expression']))
    linter._check_mako_file_is_safe(mako_template, results)
    self._validate_data_rules(data, results)
