Add and use percentage constant (#32094)
* Add and use percentage constant * Fix pylint error and broken test
This commit is contained in:
1 parent
c7f128f286
commit
f1a0ca7cd3
155 files changed
+735
-459
No files matched your search
@@ -8,7 +8,13 @@ from libpurecool.dyson_pure_cool_link import DysonPureCoolLink
|
||||
|
||||
from homeassistant.components import dyson as dyson_parent
|
||||
from homeassistant.components.dyson import sensor as dyson
|
||||
from homeassistant.const import STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT, TIME_HOURS
|
||||
from homeassistant.const import (
|
||||
STATE_OFF,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
TIME_HOURS,
|
||||
UNIT_PERCENTAGE,
|
||||
)
|
||||
from homeassistant.helpers import discovery
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
@@ -169,7 +175,7 @@ class DysonTest(unittest.TestCase):
|
||||
sensor.entity_id = "sensor.dyson_1"
|
||||
assert not sensor.should_poll
|
||||
assert sensor.state is None
|
||||
assert sensor.unit_of_measurement == "%"
|
||||
assert sensor.unit_of_measurement == UNIT_PERCENTAGE
|
||||
assert sensor.name == "Device_name Humidity"
|
||||
assert sensor.entity_id == "sensor.dyson_1"
|
||||
|
||||
@@ -180,7 +186,7 @@ class DysonTest(unittest.TestCase):
|
||||
sensor.entity_id = "sensor.dyson_1"
|
||||
assert not sensor.should_poll
|
||||
assert sensor.state == 45
|
||||
assert sensor.unit_of_measurement == "%"
|
||||
assert sensor.unit_of_measurement == UNIT_PERCENTAGE
|
||||
assert sensor.name == "Device_name Humidity"
|
||||
assert sensor.entity_id == "sensor.dyson_1"
|
||||
|
||||
@@ -191,7 +197,7 @@ class DysonTest(unittest.TestCase):
|
||||
sensor.entity_id = "sensor.dyson_1"
|
||||
assert not sensor.should_poll
|
||||
assert sensor.state == STATE_OFF
|
||||
assert sensor.unit_of_measurement == "%"
|
||||
assert sensor.unit_of_measurement == UNIT_PERCENTAGE
|
||||
assert sensor.name == "Device_name Humidity"
|
||||
assert sensor.entity_id == "sensor.dyson_1"
|
||||
|
||||
|
||||
Reference in new issue
Block a user