check-templates: Extract/improve report_problem.

We extract the function for modularity and to
allow early-return.

We also add checks for "else" and improve a few
error messages.
This commit is contained in:
Steve Howell
2021-12-01 12:06:16 +00:00
committed by Tim Abbott
parent 00e80b8c91
commit d197813b88
2 changed files with 27 additions and 19 deletions

View File

@@ -84,7 +84,7 @@ class ParserTest(unittest.TestCase):
my_html = """
<b>foo</i>
"""
self._assert_validate_error("Mismatched tag.", text=my_html)
self._assert_validate_error(r"Mismatched tags: \(b != i\)", text=my_html)
def test_validate_bad_indentation(self) -> None:
my_html = """
@@ -92,7 +92,7 @@ class ParserTest(unittest.TestCase):
foo
</p>
"""
self._assert_validate_error("Bad indentation.", text=my_html)
self._assert_validate_error("Indentation for start/end tags does not match.", text=my_html)
def test_validate_state_depth(self) -> None:
my_html = """