Upgrade black to 20.8b1 (#39287)
This commit is contained in:
parent
0d7eec710c
commit
1c2ebdf307
574 changed files with 4389 additions and 1725 deletions
|
@ -26,7 +26,10 @@ SERVER_STATUS = ServerStatus.new_from_json_dict(
|
|||
|
||||
async def init_integration(hass) -> MockConfigEntry:
|
||||
"""Set up the Nightscout integration in Home Assistant."""
|
||||
entry = MockConfigEntry(domain=DOMAIN, data={CONF_URL: "https://some.url:1234"},)
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data={CONF_URL: "https://some.url:1234"},
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.nightscout.NightscoutAPI.get_sgvs",
|
||||
return_value=GLUCOSE_READINGS,
|
||||
|
@ -43,7 +46,10 @@ async def init_integration(hass) -> MockConfigEntry:
|
|||
|
||||
async def init_integration_unavailable(hass) -> MockConfigEntry:
|
||||
"""Set up the Nightscout integration in Home Assistant."""
|
||||
entry = MockConfigEntry(domain=DOMAIN, data={CONF_URL: "https://some.url:1234"},)
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data={CONF_URL: "https://some.url:1234"},
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.nightscout.NightscoutAPI.get_sgvs",
|
||||
side_effect=ClientConnectionError(),
|
||||
|
@ -60,7 +66,10 @@ async def init_integration_unavailable(hass) -> MockConfigEntry:
|
|||
|
||||
async def init_integration_empty_response(hass) -> MockConfigEntry:
|
||||
"""Set up the Nightscout integration in Home Assistant."""
|
||||
entry = MockConfigEntry(domain=DOMAIN, data={CONF_URL: "https://some.url:1234"},)
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
data={CONF_URL: "https://some.url:1234"},
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.components.nightscout.NightscoutAPI.get_sgvs", return_value=[]
|
||||
), patch(
|
||||
|
|
|
@ -24,7 +24,8 @@ async def test_form(hass):
|
|||
|
||||
with _patch_glucose_readings(), _patch_server_status(), _patch_async_setup() as mock_setup, _patch_async_setup_entry() as mock_setup_entry:
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], CONFIG,
|
||||
result["flow_id"],
|
||||
CONFIG,
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
@ -46,7 +47,8 @@ async def test_user_form_cannot_connect(hass):
|
|||
side_effect=ClientConnectionError(),
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_URL: "https://some.url:1234"},
|
||||
result["flow_id"],
|
||||
{CONF_URL: "https://some.url:1234"},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
|
@ -64,7 +66,8 @@ async def test_user_form_unexpected_exception(hass):
|
|||
side_effect=Exception(),
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {CONF_URL: "https://some.url:1234"},
|
||||
result["flow_id"],
|
||||
{CONF_URL: "https://some.url:1234"},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
|
@ -78,7 +81,9 @@ async def test_user_form_duplicate(hass):
|
|||
entry = MockConfigEntry(domain=DOMAIN, unique_id=unique_id)
|
||||
await hass.config_entries.async_add(entry)
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=CONFIG,
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
data=CONFIG,
|
||||
)
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
@ -90,7 +95,8 @@ def _patch_async_setup():
|
|||
|
||||
def _patch_async_setup_entry():
|
||||
return patch(
|
||||
"homeassistant.components.nightscout.async_setup_entry", return_value=True,
|
||||
"homeassistant.components.nightscout.async_setup_entry",
|
||||
return_value=True,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ async def test_unload_entry(hass):
|
|||
async def test_async_setup_raises_entry_not_ready(hass):
|
||||
"""Test that it throws ConfigEntryNotReady when exception occurs during setup."""
|
||||
config_entry = MockConfigEntry(
|
||||
domain=DOMAIN, data={CONF_URL: "https://some.url:1234"},
|
||||
domain=DOMAIN,
|
||||
data={CONF_URL: "https://some.url:1234"},
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue