1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Deprecate conversion utilities (#78957)

* Deprecate utilities

* Deprecate distance and speed

* Add tests

* Adjust pylint

* Simplify temperature deprecation
This commit is contained in:
epenet
2022-09-28 19:39:44 +02:00
committed by GitHub
parent 3b05bb5b3a
commit 9c3b40dad1
11 changed files with 79 additions and 25 deletions

View File

@@ -19,6 +19,12 @@ INVALID_SYMBOL = "bob"
VALID_SYMBOL = LENGTH_KILOMETERS
def test_raise_deprecation_warning(caplog: pytest.LogCaptureFixture) -> None:
"""Ensure that a warning is raised on use of convert."""
assert distance_util.convert(2, LENGTH_METERS, LENGTH_METERS) == 2
assert "use unit_conversion.DistanceConverter instead" in caplog.text
def test_convert_same_unit():
"""Test conversion from any unit to same unit."""
assert distance_util.convert(5, LENGTH_KILOMETERS, LENGTH_KILOMETERS) == 5