Improve contextmanager typing (#122250)
This commit is contained in:
parent
5fd3b929f4
commit
6be4ef8a1f
7 changed files with 18 additions and 10 deletions
|
@ -1,9 +1,10 @@
|
|||
"""Common methods used across tests for Netatmo."""
|
||||
|
||||
from collections.abc import Iterator
|
||||
from contextlib import contextmanager
|
||||
import json
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
|
@ -109,7 +110,7 @@ async def simulate_webhook(hass: HomeAssistant, webhook_id: str, response) -> No
|
|||
|
||||
|
||||
@contextmanager
|
||||
def selected_platforms(platforms: list[Platform]) -> AsyncMock:
|
||||
def selected_platforms(platforms: list[Platform]) -> Iterator[None]:
|
||||
"""Restrict loaded platforms to list given."""
|
||||
with (
|
||||
patch("homeassistant.components.netatmo.data_handler.PLATFORMS", platforms),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue