Files
python/exercises/hamming/.meta/template.j2
Michael Morehouse 7a42fb71e2 various: comma fixes (#2150)
* forth: reinstate seperate classes

The template removed seperate classes per major case, resulting in
several tests with duplicate names and therefore an incomplete test
suite.

This reinstates the distinct classes.

Fixes #2148

* forth: minor black issue

Was accidentally running on a later version of Black than the one
specified in our requirements-generator.txt.

* various: fixes trailing comma issues

An upcoming change in Black revealed that we were adding unnecessary
trailing commas. These will _not_ be trimmed by Black in future builds.

Co-authored-by: Corey McCandless <cmccandless@users.noreply.github.com>
2019-12-24 21:28:38 -05:00

26 lines
777 B
Django/Jinja

{%- import "generator_macros.j2" as macros with context -%}
{%- macro test_call(case) %}
{{ case["property"] }}(
{% for arg in case["input"].values() -%}
"{{ arg }}"{{ "," if not loop.last }}
{% endfor %}
)
{% endmacro -%}
{{ macros.header() }}
class {{ exercise | camel_case }}Test(unittest.TestCase):
{% for case in cases -%}
def test_{{ case["description"] | to_snake }}(self):
{%- if case is error_case %}
with self.assertRaisesWithMessage(ValueError):
{{- test_call(case) }}
{%- else %}
self.assertEqual(
{{- test_call(case) }},
{{ case["expected"] }}
)
{%- endif %}
{% endfor %}
{{ macros.footer() }}