Skip to content

Commit 7a42fb7

Browse files
yawpitchcmccandless
andcommitted
various: comma fixes (exercism#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 exercism#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>
1 parent c181283 commit 7a42fb7

14 files changed

Lines changed: 16 additions & 15 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ bin/configlet.exe
1212
.cache
1313
.pytest_cache
1414
__pycache__
15+
.venv

exercises/all-your-base/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{%- macro func_call(case) -%}
44
{{ case["property"] }}(
55
{% for arg in case["input"].values() %}
6-
{{ arg }},
6+
{{ arg }}{{- "," if not loop.last }}
77
{% endfor %}
88
)
99
{%- endmacro -%}

exercises/complex-numbers/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import math
1010

1111
{%- macro formatValue(val) -%}
1212
{% if val is iterable and val is not string -%}
13-
ComplexNumber({% for part in val %}{{ translate_math(part) }},{% endfor %})
13+
ComplexNumber({% for part in val %}{{ translate_math(part) }}{{ "," if not loop.last }}{% endfor %})
1414
{%- else -%}
1515
{{ translate_math(val) }}
1616
{%- endif -%}

exercises/dominoes/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{% macro tuplify(dominoes_list) -%}
55
[
66
{%- for v in dominoes_list %}
7-
({{ v | join(', ') }}),
7+
({{ v | join(', ') }}){{- "," if not loop.last }}
88
{%- endfor %}
99
]
1010
{%- endmacro %}

exercises/etl/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{%- set input = case["input"] -%}
44
def test_{{ case["description"] | to_snake }}(self):
55
legacy_data = { {% for key, value in case["input"]["legacy"].items() %}
6-
{{key}}: {{value}},{% endfor %} }
6+
{{key}}: {{value}}{{ "," if not loop.last }}{% endfor %} }
77
data = {{case["expected"]}}
88
self.assertEqual(
99
{{ case["property"] | to_snake }}(legacy_data), data

exercises/go-counting/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{%- if territory_list %}
66
{
77
{%- for v in territory_list %}
8-
({{ v | join(', ') }}),
8+
({{ v | join(', ') }}){{ "," if not loop.last }}
99
{%- endfor %}
1010
}
1111
{%- else %}

exercises/hamming/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{%- macro test_call(case) %}
33
{{ case["property"] }}(
44
{% for arg in case["input"].values() -%}
5-
"{{ arg }}",
5+
"{{ arg }}"{{ "," if not loop.last }}
66
{% endfor %}
77
)
88
{% endmacro -%}

exercises/isogram/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{%- macro test_call(case) %}
33
{{ case["property"] | to_snake }}(
44
{% for arg in case["input"].values() -%}
5-
"{{ arg }}",
5+
"{{ arg }}"{{ "," if not loop.last }}
66
{% endfor %}
77
)
88
{% endmacro -%}

exercises/kindergarten-garden/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
garden.{{- case["property"] | to_snake -}}
1414
("{{ input["student"] }}"),
1515
[{% for val in case["expected"] -%}
16-
"{{ val | camel_case }}",
16+
"{{ val | camel_case }}"{{- "," if not loop.last }}
1717
{% endfor %}]
1818
)
1919
{% endmacro -%}

exercises/pov/.meta/template.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
Tree("{{ tree["label"] }}"
3535
{%- if tree["children"] %}, [
3636
{%- for child_tree in tree["children"] %}
37-
{{ write_tree(child_tree) | indent(4,True,True) }},
37+
{{ write_tree(child_tree) | indent(4,True,True) }}{{- "," if not loop.last }}
3838
{%- endfor %}
3939
]{% endif %})
4040
{%- endmacro -%}

0 commit comments

Comments
 (0)