{%- import "generator_macros.j2" as macros with context -%}
{%- macro test_call(case) -%}
    {{ case["property"] | to_snake }}({{ case["input"]["minefield"] }})
{%- endmacro -%}
{{ macros.header() }}

class {{ exercise | camel_case }}Test(unittest.TestCase):
    {% for case in cases -%}
    def test_{{ case["description"] | to_snake }}(self):
        self.assertEqual({{ test_call(case) }}, {{ case["expected"] }})
    {% endfor %}

    # Additional tests for this track
    {% for case in additional_cases -%}
    def test_{{ case["description"] | to_snake }}(self):
        {%- if case is error_case %}
        with self.assertRaises(ValueError) as err:
            {{ test_call(case) }}
        self.assertEqual(type(err.exception), ValueError)
        self.assertEqual(err.exception.args[0], "{{ case["expected"]["error"] }}")
        {%- else %}
        self.assertEqual({{- test_call(case) }}, {{ case["expected"] }})
        {%- endif %}
    {% endfor %}
