Improve contextmanager typing (#122250)

This commit is contained in:
Marc Mueller 2024-07-20 14:09:37 +02:00 committed by GitHub
parent 5fd3b929f4
commit 6be4ef8a1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 18 additions and 10 deletions

View file

@ -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),