Drop UNIT_ prefix for percentage constant (#39383)
This commit is contained in:
1 parent
cdc93d7110
commit
d2b1918e9c
183 files changed
+639
-661
No files matched your search
@@ -9,8 +9,8 @@ from homeassistant.const import (
|
||||
ATTR_ICON,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
DEVICE_CLASS_TIMESTAMP,
|
||||
PERCENTAGE,
|
||||
STATE_UNAVAILABLE,
|
||||
UNIT_PERCENTAGE,
|
||||
)
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.dt import UTC, utcnow
|
||||
@@ -45,7 +45,7 @@ async def test_sensors(hass):
|
||||
state = hass.states.get("sensor.hl_l2340dw_black_toner_remaining")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:printer-3d-nozzle"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "75"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_black_toner_remaining")
|
||||
@@ -55,7 +55,7 @@ async def test_sensors(hass):
|
||||
state = hass.states.get("sensor.hl_l2340dw_cyan_toner_remaining")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:printer-3d-nozzle"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "10"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_cyan_toner_remaining")
|
||||
@@ -65,7 +65,7 @@ async def test_sensors(hass):
|
||||
state = hass.states.get("sensor.hl_l2340dw_magenta_toner_remaining")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:printer-3d-nozzle"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "8"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_magenta_toner_remaining")
|
||||
@@ -75,7 +75,7 @@ async def test_sensors(hass):
|
||||
state = hass.states.get("sensor.hl_l2340dw_yellow_toner_remaining")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:printer-3d-nozzle"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "2"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_yellow_toner_remaining")
|
||||
@@ -87,7 +87,7 @@ async def test_sensors(hass):
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:chart-donut"
|
||||
assert state.attributes.get(ATTR_REMAINING_PAGES) == 11014
|
||||
assert state.attributes.get(ATTR_COUNTER) == 986
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "92"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_drum_remaining_life")
|
||||
@@ -99,7 +99,7 @@ async def test_sensors(hass):
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:chart-donut"
|
||||
assert state.attributes.get(ATTR_REMAINING_PAGES) == 16389
|
||||
assert state.attributes.get(ATTR_COUNTER) == 1611
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "92"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_black_drum_remaining_life")
|
||||
@@ -111,7 +111,7 @@ async def test_sensors(hass):
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:chart-donut"
|
||||
assert state.attributes.get(ATTR_REMAINING_PAGES) == 16389
|
||||
assert state.attributes.get(ATTR_COUNTER) == 1611
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "92"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_cyan_drum_remaining_life")
|
||||
@@ -123,7 +123,7 @@ async def test_sensors(hass):
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:chart-donut"
|
||||
assert state.attributes.get(ATTR_REMAINING_PAGES) == 16389
|
||||
assert state.attributes.get(ATTR_COUNTER) == 1611
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "92"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_magenta_drum_remaining_life")
|
||||
@@ -135,7 +135,7 @@ async def test_sensors(hass):
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:chart-donut"
|
||||
assert state.attributes.get(ATTR_REMAINING_PAGES) == 16389
|
||||
assert state.attributes.get(ATTR_COUNTER) == 1611
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "92"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_yellow_drum_remaining_life")
|
||||
@@ -145,7 +145,7 @@ async def test_sensors(hass):
|
||||
state = hass.states.get("sensor.hl_l2340dw_fuser_remaining_life")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:water-outline"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "97"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_fuser_remaining_life")
|
||||
@@ -155,7 +155,7 @@ async def test_sensors(hass):
|
||||
state = hass.states.get("sensor.hl_l2340dw_belt_unit_remaining_life")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:current-ac"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "97"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_belt_unit_remaining_life")
|
||||
@@ -165,7 +165,7 @@ async def test_sensors(hass):
|
||||
state = hass.states.get("sensor.hl_l2340dw_pf_kit_1_remaining_life")
|
||||
assert state
|
||||
assert state.attributes.get(ATTR_ICON) == "mdi:printer-3d"
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UNIT_PERCENTAGE
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE
|
||||
assert state.state == "98"
|
||||
|
||||
entry = registry.async_get("sensor.hl_l2340dw_pf_kit_1_remaining_life")
|
||||
|
||||
Reference in new issue
Block a user