1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add typing to tests with single hass argument (#87631)

This commit is contained in:
epenet
2023-02-07 15:01:16 +01:00
committed by GitHub
parent fe9f6823c3
commit 59ca7780fa
33 changed files with 104 additions and 75 deletions

View File

@@ -25,6 +25,7 @@ from homeassistant.const import (
CONF_REGION,
CONF_TOKEN,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError
from homeassistant.setup import async_setup_component
from homeassistant.util import location
@@ -195,7 +196,7 @@ async def setup_mock_component(hass):
await hass.async_block_till_done()
def test_games_reformat_to_dict(hass):
def test_games_reformat_to_dict(hass: HomeAssistant) -> None:
"""Test old data format is converted to new format."""
with patch(
"homeassistant.components.ps4.load_json",
@@ -218,7 +219,7 @@ def test_games_reformat_to_dict(hass):
assert mock_data[ATTR_MEDIA_CONTENT_TYPE] == MediaType.GAME
def test_load_games(hass):
def test_load_games(hass: HomeAssistant) -> None:
"""Test that games are loaded correctly."""
with patch(
"homeassistant.components.ps4.load_json", return_value=MOCK_GAMES
@@ -237,7 +238,7 @@ def test_load_games(hass):
assert mock_data[ATTR_MEDIA_CONTENT_TYPE] == MediaType.GAME
def test_loading_games_returns_dict(hass):
def test_loading_games_returns_dict(hass: HomeAssistant) -> None:
"""Test that loading games always returns a dict."""
with patch(
"homeassistant.components.ps4.load_json", side_effect=HomeAssistantError