diff --git a/tests/util/test_temperature.py b/tests/util/test_temperature.py index 7730a89cbb8..71693683fa3 100644 --- a/tests/util/test_temperature.py +++ b/tests/util/test_temperature.py @@ -8,6 +8,23 @@ INVALID_SYMBOL = "bob" VALID_SYMBOL = TEMP_CELSIUS +@pytest.mark.parametrize( + "function_name, value, expected", + [ + ("fahrenheit_to_celsius", 75.2, 24), + ("kelvin_to_celsius", 297.65, 24.5), + ("celsius_to_fahrenheit", 23, 73.4), + ("celsius_to_kelvin", 23, 296.15), + ], +) +def test_deprecated_functions( + function_name: str, value: float, expected: float +) -> None: + """Test that deprecated function still work.""" + convert = getattr(temperature_util, function_name) + assert convert(value) == expected + + def test_convert_same_unit(): """Test conversion from any unit to same unit.""" assert temperature_util.convert(2, TEMP_CELSIUS, TEMP_CELSIUS) == 2 diff --git a/tests/util/test_volume.py b/tests/util/test_volume.py index f78d6c4ed18..5362f3099fb 100644 --- a/tests/util/test_volume.py +++ b/tests/util/test_volume.py @@ -16,6 +16,23 @@ INVALID_SYMBOL = "bob" VALID_SYMBOL = VOLUME_LITERS +@pytest.mark.parametrize( + "function_name, value, expected", + [ + ("liter_to_gallon", 2, pytest.approx(0.528344)), + ("gallon_to_liter", 2, 7.570823568), + ("cubic_meter_to_cubic_feet", 2, pytest.approx(70.629333)), + ("cubic_feet_to_cubic_meter", 2, pytest.approx(0.0566337)), + ], +) +def test_deprecated_functions( + function_name: str, value: float, expected: float +) -> None: + """Test that deprecated function still work.""" + convert = getattr(volume_util, function_name) + assert convert(value) == expected + + def test_convert_same_unit(): """Test conversion from any unit to same unit.""" assert volume_util.convert(2, VOLUME_LITERS, VOLUME_LITERS) == 2