mirror of
https://github.com/home-assistant/core.git
synced 2025-11-15 22:10:09 +00:00
Replace the usage of unit constants by enumerations in Tests [h-l] (#85934)
This commit is contained in:
@@ -48,8 +48,7 @@ from homeassistant.const import (
|
||||
CONF_PORT,
|
||||
CONF_TYPE,
|
||||
STATE_UNKNOWN,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
UnitOfTemperature,
|
||||
)
|
||||
from homeassistant.core import State
|
||||
|
||||
@@ -211,14 +210,14 @@ def test_cleanup_name_for_homekit():
|
||||
|
||||
def test_temperature_to_homekit():
|
||||
"""Test temperature conversion from HA to HomeKit."""
|
||||
assert temperature_to_homekit(20.46, TEMP_CELSIUS) == 20.5
|
||||
assert temperature_to_homekit(92.1, TEMP_FAHRENHEIT) == 33.4
|
||||
assert temperature_to_homekit(20.46, UnitOfTemperature.CELSIUS) == 20.5
|
||||
assert temperature_to_homekit(92.1, UnitOfTemperature.FAHRENHEIT) == 33.4
|
||||
|
||||
|
||||
def test_temperature_to_states():
|
||||
"""Test temperature conversion from HomeKit to HA."""
|
||||
assert temperature_to_states(20, TEMP_CELSIUS) == 20.0
|
||||
assert temperature_to_states(20.2, TEMP_FAHRENHEIT) == 68.5
|
||||
assert temperature_to_states(20, UnitOfTemperature.CELSIUS) == 20.0
|
||||
assert temperature_to_states(20.2, UnitOfTemperature.FAHRENHEIT) == 68.5
|
||||
|
||||
|
||||
def test_density_to_air_quality():
|
||||
|
||||
Reference in New Issue
Block a user