Replace the usage of unit constants by enumerations in Tests [h-l] (#85934)

This commit is contained in:
Michael 2023-01-15 14:52:55 +01:00 committed by GitHub
parent 72d3fa6d89
commit e35ab75c0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 174 additions and 150 deletions

View file

@ -4,7 +4,7 @@ from unittest.mock import MagicMock
import pytest
from homeassistant.components.sensor import DOMAIN as PLATFORM_DOMAIN, SensorDeviceClass
from homeassistant.const import MASS_POUNDS, PERCENTAGE, STATE_UNKNOWN
from homeassistant.const import PERCENTAGE, STATE_UNKNOWN, UnitOfMass
from homeassistant.core import HomeAssistant
from .conftest import setup_integration
@ -92,7 +92,7 @@ async def test_litter_robot_sensor(
assert sensor.attributes["unit_of_measurement"] == PERCENTAGE
sensor = hass.states.get("sensor.test_pet_weight")
assert sensor.state == "12.0"
assert sensor.attributes["unit_of_measurement"] == MASS_POUNDS
assert sensor.attributes["unit_of_measurement"] == UnitOfMass.POUNDS
async def test_feeder_robot_sensor(