Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
50356aa8
Unverified
Commit
50356aa8
authored
9 months ago
by
epenet
Committed by
GitHub
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Drop use of deprecated constant in zha tests (#119397)
parent
68a84c36
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/components/zha/test_sensor.py
+9
-14
9 additions, 14 deletions
tests/components/zha/test_sensor.py
with
9 additions
and
14 deletions
tests/components/zha/test_sensor.py
+
9
−
14
View file @
50356aa8
"""
Test ZHA sensor.
"""
from
collections.abc
import
Callable
from
datetime
import
timedelta
import
math
from
typing
import
Any
...
...
@@ -23,8 +24,6 @@ from homeassistant.const import (
ATTR_DEVICE_CLASS
,
ATTR_UNIT_OF_MEASUREMENT
,
CONF_UNIT_SYSTEM
,
CONF_UNIT_SYSTEM_IMPERIAL
,
CONF_UNIT_SYSTEM_METRIC
,
LIGHT_LUX
,
PERCENTAGE
,
STATE_UNAVAILABLE
,
...
...
@@ -633,10 +632,10 @@ def assert_state(hass: HomeAssistant, entity_id, state, unit_of_measurement):
@pytest.fixture
def
hass_ms
(
hass
:
HomeAssistant
):
def
hass_ms
(
hass
:
HomeAssistant
)
->
Callable
[[
str
],
HomeAssistant
]
:
"""
Hass instance with measurement system.
"""
async
def
_hass_ms
(
meas_sys
)
:
async
def
_hass_ms
(
meas_sys
:
str
)
->
HomeAssistant
:
await
config_util
.
async_process_ha_core_config
(
hass
,
{
CONF_UNIT_SYSTEM
:
meas_sys
}
)
...
...
@@ -688,11 +687,11 @@ def core_rs(hass_storage: dict[str, Any]):
)
async
def
test_temp_uom
(
hass
:
HomeAssistant
,
uom
,
raw_temp
,
expected
,
restore
,
hass_ms
,
uom
:
UnitOfTemperature
,
raw_temp
:
int
,
expected
:
int
,
restore
:
bool
,
hass_ms
:
Callable
[[
str
],
HomeAssistant
]
,
core_rs
,
zigpy_device_mock
,
zha_device_restored
,
...
...
@@ -704,11 +703,7 @@ async def test_temp_uom(
core_rs
(
entity_id
,
uom
,
state
=
(
expected
-
2
))
await
async_mock_load_restore_state_from_storage
(
hass
)
hass
=
await
hass_ms
(
CONF_UNIT_SYSTEM_METRIC
if
uom
==
UnitOfTemperature
.
CELSIUS
else
CONF_UNIT_SYSTEM_IMPERIAL
)
hass
=
await
hass_ms
(
"
metric
"
if
uom
==
UnitOfTemperature
.
CELSIUS
else
"
imperial
"
)
zigpy_device
=
zigpy_device_mock
(
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment