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
|
@ -12,6 +12,7 @@ from homeassistant.components.canary.sensor import (
|
|||
STATE_AIR_QUALITY_VERY_ABNORMAL,
|
||||
CanarySensor,
|
||||
)
|
||||
from homeassistant.const import UNIT_PERCENTAGE
|
||||
|
||||
from tests.common import get_test_home_assistant
|
||||
from tests.components.canary.test_init import mock_device, mock_location
|
||||
|
@ -97,7 +98,7 @@ class TestCanarySensorSetup(unittest.TestCase):
|
|||
sensor.update()
|
||||
|
||||
assert "Home Family Room Humidity" == sensor.name
|
||||
assert "%" == sensor.unit_of_measurement
|
||||
assert UNIT_PERCENTAGE == sensor.unit_of_measurement
|
||||
assert 50.46 == sensor.state
|
||||
assert "mdi:water-percent" == sensor.icon
|
||||
|
||||
|
@ -184,7 +185,7 @@ class TestCanarySensorSetup(unittest.TestCase):
|
|||
sensor.update()
|
||||
|
||||
assert "Home Family Room Battery" == sensor.name
|
||||
assert "%" == sensor.unit_of_measurement
|
||||
assert UNIT_PERCENTAGE == sensor.unit_of_measurement
|
||||
assert 70.46 == sensor.state
|
||||
assert "mdi:battery-70" == sensor.icon
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue