From 70b5614e86aa3434b6322604dcf8e4b6d7ed73f8 Mon Sep 17 00:00:00 2001 From: Thibaut Voirand Date: Mon, 1 Apr 2024 12:16:04 +0200 Subject: [PATCH] test(test_main.py): improve mean speed test with parametrization --- tests/test_main.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index ccda666..b200bc2 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -7,20 +7,16 @@ # third party import numpy as np +import pytest # current project from duventchezmoi.main import compute_mean_wind_speed from duventchezmoi.main import write_report -def test_compute_mean_speed(): +@pytest.mark.parametrize("units, expected_result", [("km/h", 18.65), ("m/s", 5.18)]) +def test_compute_mean_speed(units, expected_result): grib2_file = Path(__file__).parent / "20240330_0000.grib2" - units = "km/h" - expected_result = 18.65 - value = compute_mean_wind_speed(grib2_file, units) - assert np.round(value, decimals=2) == expected_result - units = "m/s" - expected_result = 5.18 value = compute_mean_wind_speed(grib2_file, units) assert np.round(value, decimals=2) == expected_result