1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Bump ruff to 0.3.4 (#112690)

Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Joost Lekkerkerker
2024-03-26 00:02:16 +01:00
committed by GitHub
parent 27219b6962
commit 6bb4e7d62c
1044 changed files with 24245 additions and 16750 deletions

View File

@@ -54,30 +54,34 @@ async def test_setup_provide_implementation(hass: HomeAssistant) -> None:
legacy_entry.add_to_hass(hass)
account_link.async_setup(hass)
with patch(
"homeassistant.components.cloud.account_link._get_services",
return_value=[
{"service": "test", "min_version": "0.1.0"},
{"service": "too_new", "min_version": "1000000.0.0"},
{"service": "dev", "min_version": "2022.9.0"},
{
"service": "deprecated",
"min_version": "0.1.0",
"accepts_new_authorizations": False,
},
{
"service": "legacy",
"min_version": "0.1.0",
"accepts_new_authorizations": False,
},
{
"service": "no_cloud",
"min_version": "0.1.0",
"accepts_new_authorizations": False,
},
],
), patch(
"homeassistant.components.cloud.account_link.HA_VERSION", "2022.9.0.dev20220817"
with (
patch(
"homeassistant.components.cloud.account_link._get_services",
return_value=[
{"service": "test", "min_version": "0.1.0"},
{"service": "too_new", "min_version": "1000000.0.0"},
{"service": "dev", "min_version": "2022.9.0"},
{
"service": "deprecated",
"min_version": "0.1.0",
"accepts_new_authorizations": False,
},
{
"service": "legacy",
"min_version": "0.1.0",
"accepts_new_authorizations": False,
},
{
"service": "no_cloud",
"min_version": "0.1.0",
"accepts_new_authorizations": False,
},
],
),
patch(
"homeassistant.components.cloud.account_link.HA_VERSION",
"2022.9.0.dev20220817",
),
):
assert (
await config_entry_oauth2_flow.async_get_implementations(
@@ -132,10 +136,13 @@ async def test_get_services_cached(hass: HomeAssistant) -> None:
services = 1
with patch.object(account_link, "CACHE_TIMEOUT", 0), patch(
"hass_nabucasa.account_link.async_fetch_available_services",
side_effect=lambda _: services,
) as mock_fetch:
with (
patch.object(account_link, "CACHE_TIMEOUT", 0),
patch(
"hass_nabucasa.account_link.async_fetch_available_services",
side_effect=lambda _: services,
) as mock_fetch,
):
assert await account_link._get_services(hass) == 1
services = 2
@@ -159,9 +166,12 @@ async def test_get_services_error(hass: HomeAssistant) -> None:
"""Test that we cache services."""
hass.data["cloud"] = None
with patch.object(account_link, "CACHE_TIMEOUT", 0), patch(
"hass_nabucasa.account_link.async_fetch_available_services",
side_effect=TimeoutError,
with (
patch.object(account_link, "CACHE_TIMEOUT", 0),
patch(
"hass_nabucasa.account_link.async_fetch_available_services",
side_effect=TimeoutError,
),
):
assert await account_link._get_services(hass) == []
assert account_link.DATA_SERVICES not in hass.data