Add and use percentage constant (#32094)
* Add and use percentage constant * Fix pylint error and broken test
This commit is contained in:
parent
c7f128f286
commit
f1a0ca7cd3
155 changed files with 735 additions and 459 deletions
|
@ -3,7 +3,7 @@ from datetime import datetime
|
|||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
from homeassistant.const import SPEED_METERS_PER_SECOND
|
||||
from homeassistant.const import SPEED_METERS_PER_SECOND, UNIT_PERCENTAGE
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import assert_setup_component, load_fixture
|
||||
|
@ -63,11 +63,11 @@ async def test_custom_setup(hass, aioclient_mock):
|
|||
assert state.state == "103.6"
|
||||
|
||||
state = hass.states.get("sensor.yr_humidity")
|
||||
assert state.attributes.get("unit_of_measurement") == "%"
|
||||
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
|
||||
assert state.state == "55.5"
|
||||
|
||||
state = hass.states.get("sensor.yr_fog")
|
||||
assert state.attributes.get("unit_of_measurement") == "%"
|
||||
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
|
||||
assert state.state == "0.0"
|
||||
|
||||
state = hass.states.get("sensor.yr_wind_speed")
|
||||
|
@ -109,11 +109,11 @@ async def test_forecast_setup(hass, aioclient_mock):
|
|||
assert state.state == "148.9"
|
||||
|
||||
state = hass.states.get("sensor.yr_humidity")
|
||||
assert state.attributes.get("unit_of_measurement") == "%"
|
||||
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
|
||||
assert state.state == "77.4"
|
||||
|
||||
state = hass.states.get("sensor.yr_fog")
|
||||
assert state.attributes.get("unit_of_measurement") == "%"
|
||||
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
|
||||
assert state.state == "0.0"
|
||||
|
||||
state = hass.states.get("sensor.yr_wind_speed")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue