{%- import "generator_macros.j2" as macros with context -%}
{%- macro test_case( case) -%}
    {%- set input = case["input"] -%}
    {%- set property = case["property"] -%}
    def test_{{ case["description"] | to_snake }}(self):
        school = School()
        {% for student, grade in input["students"] -%}
        school.add_student(name="{{ student }}", grade={{ grade }})
        {% endfor -%}
        expected = {{ case["expected"] }}
        {% if "desiredGrade" in input -%}
        self.assertEqual(school.{{ case["property"] | to_snake }}({{ input["desiredGrade"] }}), expected)
        {%- elif "add" in property -%}
        self.assertEqual(school.added(), expected)
        {% else %}
        self.assertEqual(school.{{ case["property"] | to_snake }}(), expected)
        {%- endif %}
{% endmacro -%}
{{ macros.header(["School"]) }}

class {{ exercise | camel_case }}Test(unittest.TestCase):
    {% for case in cases %}
    {{ test_case(case) }}
    {% endfor %}
