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>
This commit is contained in:
committed by
Corey McCandless
parent
c1812833ec
commit
7a42fb71e2
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,3 +12,4 @@ bin/configlet.exe
|
|||||||
.cache
|
.cache
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
__pycache__
|
__pycache__
|
||||||
|
.venv
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{%- macro func_call(case) -%}
|
{%- macro func_call(case) -%}
|
||||||
{{ case["property"] }}(
|
{{ case["property"] }}(
|
||||||
{% for arg in case["input"].values() %}
|
{% for arg in case["input"].values() %}
|
||||||
{{ arg }},
|
{{ arg }}{{- "," if not loop.last }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
)
|
)
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import math
|
|||||||
|
|
||||||
{%- macro formatValue(val) -%}
|
{%- macro formatValue(val) -%}
|
||||||
{% if val is iterable and val is not string -%}
|
{% if val is iterable and val is not string -%}
|
||||||
ComplexNumber({% for part in val %}{{ translate_math(part) }},{% endfor %})
|
ComplexNumber({% for part in val %}{{ translate_math(part) }}{{ "," if not loop.last }}{% endfor %})
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{{ translate_math(val) }}
|
{{ translate_math(val) }}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
{% macro tuplify(dominoes_list) -%}
|
{% macro tuplify(dominoes_list) -%}
|
||||||
[
|
[
|
||||||
{%- for v in dominoes_list %}
|
{%- for v in dominoes_list %}
|
||||||
({{ v | join(', ') }}),
|
({{ v | join(', ') }}){{- "," if not loop.last }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
]
|
]
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{%- set input = case["input"] -%}
|
{%- set input = case["input"] -%}
|
||||||
def test_{{ case["description"] | to_snake }}(self):
|
def test_{{ case["description"] | to_snake }}(self):
|
||||||
legacy_data = { {% for key, value in case["input"]["legacy"].items() %}
|
legacy_data = { {% for key, value in case["input"]["legacy"].items() %}
|
||||||
{{key}}: {{value}},{% endfor %} }
|
{{key}}: {{value}}{{ "," if not loop.last }}{% endfor %} }
|
||||||
data = {{case["expected"]}}
|
data = {{case["expected"]}}
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
{{ case["property"] | to_snake }}(legacy_data), data
|
{{ case["property"] | to_snake }}(legacy_data), data
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{%- if territory_list %}
|
{%- if territory_list %}
|
||||||
{
|
{
|
||||||
{%- for v in territory_list %}
|
{%- for v in territory_list %}
|
||||||
({{ v | join(', ') }}),
|
({{ v | join(', ') }}){{ "," if not loop.last }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
}
|
}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{%- macro test_call(case) %}
|
{%- macro test_call(case) %}
|
||||||
{{ case["property"] }}(
|
{{ case["property"] }}(
|
||||||
{% for arg in case["input"].values() -%}
|
{% for arg in case["input"].values() -%}
|
||||||
"{{ arg }}",
|
"{{ arg }}"{{ "," if not loop.last }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
)
|
)
|
||||||
{% endmacro -%}
|
{% endmacro -%}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{%- macro test_call(case) %}
|
{%- macro test_call(case) %}
|
||||||
{{ case["property"] | to_snake }}(
|
{{ case["property"] | to_snake }}(
|
||||||
{% for arg in case["input"].values() -%}
|
{% for arg in case["input"].values() -%}
|
||||||
"{{ arg }}",
|
"{{ arg }}"{{ "," if not loop.last }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
)
|
)
|
||||||
{% endmacro -%}
|
{% endmacro -%}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
garden.{{- case["property"] | to_snake -}}
|
garden.{{- case["property"] | to_snake -}}
|
||||||
("{{ input["student"] }}"),
|
("{{ input["student"] }}"),
|
||||||
[{% for val in case["expected"] -%}
|
[{% for val in case["expected"] -%}
|
||||||
"{{ val | camel_case }}",
|
"{{ val | camel_case }}"{{- "," if not loop.last }}
|
||||||
{% endfor %}]
|
{% endfor %}]
|
||||||
)
|
)
|
||||||
{% endmacro -%}
|
{% endmacro -%}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
Tree("{{ tree["label"] }}"
|
Tree("{{ tree["label"] }}"
|
||||||
{%- if tree["children"] %}, [
|
{%- if tree["children"] %}, [
|
||||||
{%- for child_tree in tree["children"] %}
|
{%- for child_tree in tree["children"] %}
|
||||||
{{ write_tree(child_tree) | indent(4,True,True) }},
|
{{ write_tree(child_tree) | indent(4,True,True) }}{{- "," if not loop.last }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
]{% endif %})
|
]{% endif %})
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{%- macro test_call(case) %}
|
{%- macro test_call(case) %}
|
||||||
{{ case["property"] | to_snake }}(
|
{{ case["property"] | to_snake }}(
|
||||||
{% for arg in case["input"].values() -%}
|
{% for arg in case["input"].values() -%}
|
||||||
{{ arg }},
|
{{ arg }}{{- "," if not loop.last }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
)
|
)
|
||||||
{% endmacro -%}
|
{% endmacro -%}
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ class {{ exercise | camel_case }}Test(unittest.TestCase):
|
|||||||
payload = json.dumps({{ input["payload"] }})
|
payload = json.dumps({{ input["payload"] }})
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
response = api.{{ case["property"] }}(
|
response = api.{{ case["property"] }}(
|
||||||
"{{ input["url"] }}",
|
"{{ input["url"] }}"
|
||||||
{%- if "payload" in input %}
|
{%- if "payload" in input %}
|
||||||
payload,
|
, payload
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
)
|
)
|
||||||
expected = {{ case["expected"] }}
|
expected = {{ case["expected"] }}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class {{ exercise | camel_case }}Test(unittest.TestCase):
|
|||||||
(
|
(
|
||||||
{{ case["expected"]["moves"] }},
|
{{ case["expected"]["moves"] }},
|
||||||
"{{ case["expected"]["goalBucket"] }}",
|
"{{ case["expected"]["goalBucket"] }}",
|
||||||
{{ case["expected"]["otherBucket"] }},
|
{{ case["expected"]["otherBucket"] }}
|
||||||
))
|
))
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{%- macro list_int_to_hex(integers) %}
|
{%- macro list_int_to_hex(integers) %}
|
||||||
[
|
[
|
||||||
{% for integer in integers -%}
|
{% for integer in integers -%}
|
||||||
{{ "0x{:x}".format(integer) }},
|
{{ "0x{:x}".format(integer) }}{{- "," if not loop.last }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
]
|
]
|
||||||
{% endmacro -%}
|
{% endmacro -%}
|
||||||
|
|||||||
Reference in New Issue
Block a user