* 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>
21 lines
734 B
Django/Jinja
21 lines
734 B
Django/Jinja
{%- import "generator_macros.j2" as macros with context -%}
|
|
{% macro test_case(case) -%}
|
|
{%- set input = case["input"] -%}
|
|
def test_{{ case["description"] | to_snake }}(self):
|
|
legacy_data = { {% for key, value in case["input"]["legacy"].items() %}
|
|
{{key}}: {{value}}{{ "," if not loop.last }}{% endfor %} }
|
|
data = {{case["expected"]}}
|
|
self.assertEqual(
|
|
{{ case["property"] | to_snake }}(legacy_data), data
|
|
)
|
|
{%- endmacro %}
|
|
{{ macros.header()}}
|
|
|
|
class {{ exercise | camel_case }}Test(unittest.TestCase):
|
|
{% for supercase in cases %}{% for case in supercase["cases"] -%}
|
|
{{ test_case(case) }}
|
|
{% endfor %}{% endfor %}
|
|
|
|
|
|
{{ macros.footer() }}
|