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

+3 -3
View File
@@ -1,7 +1,7 @@
"""Tests for the TekSavvy sensor platform."""
from homeassistant.bootstrap import async_setup_component
from homeassistant.components.teksavvy.sensor import TekSavvyData
from homeassistant.const import DATA_GIGABYTES
from homeassistant.const import DATA_GIGABYTES, UNIT_PERCENTAGE
from homeassistant.helpers.aiohttp_client import async_get_clientsession
@@ -74,7 +74,7 @@ async def test_capped_setup(hass, aioclient_mock):
assert state.state == "235.57"
state = hass.states.get("sensor.teksavvy_usage_ratio")
assert state.attributes.get("unit_of_measurement") == "%"
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
assert state.state == "56.69"
state = hass.states.get("sensor.teksavvy_usage")
@@ -159,7 +159,7 @@ async def test_unlimited_setup(hass, aioclient_mock):
assert state.state == "226.75"
state = hass.states.get("sensor.teksavvy_usage_ratio")
assert state.attributes.get("unit_of_measurement") == "%"
assert state.attributes.get("unit_of_measurement") == UNIT_PERCENTAGE
assert state.state == "0"
state = hass.states.get("sensor.teksavvy_remaining")