Add and use percentage constant (#32094)

* Add and use percentage constant

* Fix pylint error and broken test
This commit is contained in:
springstan authored and GitHub committed 2020-02-28 11:46:48 -08:00
1 parent c7f128f286
commit f1a0ca7cd3
155 files changed
+735 -459

No files matched your search

+5 -5
View File
@@ -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")