From 48ee49b00ca76226a7513baf4197ff02862956f3 Mon Sep 17 00:00:00 2001 From: wingechr Date: Tue, 21 Nov 2023 15:00:57 +0100 Subject: [PATCH] Update tests/test_api_data.py yea, thanks! I am not used to pytest yet. Co-authored-by: Johannes Aschauer <38501948+joAschauer@users.noreply.github.com> --- tests/test_api_data.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test_api_data.py b/tests/test_api_data.py index 6219baba..f2cb083c 100644 --- a/tests/test_api_data.py +++ b/tests/test_api_data.py @@ -133,17 +133,17 @@ def test_get_parameter_value( assert expected == pytest.approx(result) -def test_get_dimensions_parameter_code(ptxdata_static): - code = ptxdata_static.get_dimensions_parameter_code("country", "Germany") - assert code == "DEU" - - code = ptxdata_static.get_dimensions_parameter_code("country", "") - assert code == "" - - code = ptxdata_static.get_dimensions_parameter_code("country", None) - assert code == "" - - code = ptxdata_static.get_dimensions_parameter_code( - "secproc_water", "Specific costs" - ) - assert code == "" +@pytest.mark.parametrize( + "dimension, parameter_name, expected_code", + ( + ("country", "Germany", "DEU"), + ("country", "", ""), + ("country", None, ""), + ("secproc_water", "Specific costs", ""), + ), +) +def test_get_dimensions_parameter_code( + ptxdata_static, dimension, parameter_name, expected_code +): + out_code = ptxdata_static.get_dimensions_parameter_code(dimension, parameter_name) + assert out_code == expected_code