Upgrade black to 20.8b1 (#39287)
This commit is contained in:
parent
0d7eec710c
commit
1c2ebdf307
574 changed files with 4389 additions and 1725 deletions
|
@ -45,7 +45,8 @@ async def test_user_form(hass):
|
|||
return_value=12345,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], {"auto_start": True, "include_domains": ["light"]},
|
||||
result["flow_id"],
|
||||
{"auto_start": True, "include_domains": ["light"]},
|
||||
)
|
||||
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
|
@ -54,9 +55,13 @@ async def test_user_form(hass):
|
|||
with patch(
|
||||
"homeassistant.components.homekit.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.homekit.async_setup_entry", return_value=True,
|
||||
"homeassistant.components.homekit.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
result3 = await hass.config_entries.flow.async_configure(result["flow_id"], {},)
|
||||
result3 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
assert result3["title"][:11] == "HASS Bridge"
|
||||
|
@ -98,7 +103,8 @@ async def test_import(hass):
|
|||
with patch(
|
||||
"homeassistant.components.homekit.async_setup", return_value=True
|
||||
) as mock_setup, patch(
|
||||
"homeassistant.components.homekit.async_setup_entry", return_value=True,
|
||||
"homeassistant.components.homekit.async_setup_entry",
|
||||
return_value=True,
|
||||
) as mock_setup_entry:
|
||||
result2 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
|
@ -142,14 +148,16 @@ async def test_options_flow_advanced(hass):
|
|||
assert result["step_id"] == "exclude"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={"exclude_entities": ["climate.old"]},
|
||||
result["flow_id"],
|
||||
user_input={"exclude_entities": ["climate.old"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["step_id"] == "advanced"
|
||||
|
||||
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"], user_input={"auto_start": True, "safe_mode": True},
|
||||
result2["flow_id"],
|
||||
user_input={"auto_start": True, "safe_mode": True},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
@ -182,21 +190,24 @@ async def test_options_flow_basic(hass):
|
|||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={"include_domains": ["fan", "vacuum", "climate"]},
|
||||
result["flow_id"],
|
||||
user_input={"include_domains": ["fan", "vacuum", "climate"]},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["step_id"] == "exclude"
|
||||
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={"exclude_entities": ["climate.old"]},
|
||||
result["flow_id"],
|
||||
user_input={"exclude_entities": ["climate.old"]},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result2["step_id"] == "advanced"
|
||||
|
||||
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"], user_input={"safe_mode": True},
|
||||
result2["flow_id"],
|
||||
user_input={"safe_mode": True},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
@ -248,7 +259,8 @@ async def test_options_flow_with_cameras(hass):
|
|||
assert result2["step_id"] == "cameras"
|
||||
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"], user_input={"camera_copy": ["camera.native_h264"]},
|
||||
result2["flow_id"],
|
||||
user_input={"camera_copy": ["camera.native_h264"]},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
|
@ -256,7 +268,8 @@ async def test_options_flow_with_cameras(hass):
|
|||
|
||||
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
|
||||
result4 = await hass.config_entries.options.async_configure(
|
||||
result3["flow_id"], user_input={"safe_mode": True},
|
||||
result3["flow_id"],
|
||||
user_input={"safe_mode": True},
|
||||
)
|
||||
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
@ -297,7 +310,8 @@ async def test_options_flow_with_cameras(hass):
|
|||
assert result2["step_id"] == "cameras"
|
||||
|
||||
result3 = await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"], user_input={"camera_copy": []},
|
||||
result2["flow_id"],
|
||||
user_input={"camera_copy": []},
|
||||
)
|
||||
|
||||
assert result3["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
|
@ -305,7 +319,8 @@ async def test_options_flow_with_cameras(hass):
|
|||
|
||||
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
|
||||
result4 = await hass.config_entries.options.async_configure(
|
||||
result3["flow_id"], user_input={"safe_mode": True},
|
||||
result3["flow_id"],
|
||||
user_input={"safe_mode": True},
|
||||
)
|
||||
|
||||
assert result4["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
@ -356,6 +371,7 @@ async def test_options_flow_blocked_when_from_yaml(hass):
|
|||
|
||||
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
|
||||
result2 = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"], user_input={},
|
||||
result["flow_id"],
|
||||
user_input={},
|
||||
)
|
||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||
|
|
|
@ -271,7 +271,8 @@ def test_type_vacuum(type_name, entity_id, state, attrs):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"type_name, entity_id, state, attrs", [("Camera", "camera.basic", "on", {})],
|
||||
"type_name, entity_id, state, attrs",
|
||||
[("Camera", "camera.basic", "on", {})],
|
||||
)
|
||||
def test_type_camera(type_name, entity_id, state, attrs):
|
||||
"""Test if camera types are associated correctly."""
|
||||
|
|
|
@ -917,7 +917,8 @@ async def test_raise_config_entry_not_ready(hass):
|
|||
entry.add_to_hass(hass)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.homekit.port_is_available", return_value=False,
|
||||
"homeassistant.components.homekit.port_is_available",
|
||||
return_value=False,
|
||||
):
|
||||
assert not await hass.config_entries.async_setup(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
|
|
@ -142,7 +142,14 @@ async def test_camera_stream_source_configured(hass, run_driver, events):
|
|||
2,
|
||||
{CONF_STREAM_SOURCE: "/dev/null", CONF_SUPPORT_AUDIO: True},
|
||||
)
|
||||
not_camera_acc = Switch(hass, run_driver, "Switch", entity_id, 4, {},)
|
||||
not_camera_acc = Switch(
|
||||
hass,
|
||||
run_driver,
|
||||
"Switch",
|
||||
entity_id,
|
||||
4,
|
||||
{},
|
||||
)
|
||||
bridge = HomeBridge("hass", run_driver, "Test Bridge")
|
||||
bridge.add_accessory(acc)
|
||||
bridge.add_accessory(not_camera_acc)
|
||||
|
@ -247,7 +254,14 @@ async def test_camera_stream_source_configured_with_failing_ffmpeg(
|
|||
2,
|
||||
{CONF_STREAM_SOURCE: "/dev/null", CONF_SUPPORT_AUDIO: True},
|
||||
)
|
||||
not_camera_acc = Switch(hass, run_driver, "Switch", entity_id, 4, {},)
|
||||
not_camera_acc = Switch(
|
||||
hass,
|
||||
run_driver,
|
||||
"Switch",
|
||||
entity_id,
|
||||
4,
|
||||
{},
|
||||
)
|
||||
bridge = HomeBridge("hass", run_driver, "Test Bridge")
|
||||
bridge.add_accessory(acc)
|
||||
bridge.add_accessory(not_camera_acc)
|
||||
|
@ -284,7 +298,14 @@ async def test_camera_stream_source_found(hass, run_driver, events):
|
|||
|
||||
hass.states.async_set(entity_id, None)
|
||||
await hass.async_block_till_done()
|
||||
acc = Camera(hass, run_driver, "Camera", entity_id, 2, {},)
|
||||
acc = Camera(
|
||||
hass,
|
||||
run_driver,
|
||||
"Camera",
|
||||
entity_id,
|
||||
2,
|
||||
{},
|
||||
)
|
||||
await acc.run_handler()
|
||||
|
||||
assert acc.aid == 2
|
||||
|
@ -327,7 +348,14 @@ async def test_camera_stream_source_fails(hass, run_driver, events):
|
|||
|
||||
hass.states.async_set(entity_id, None)
|
||||
await hass.async_block_till_done()
|
||||
acc = Camera(hass, run_driver, "Camera", entity_id, 2, {},)
|
||||
acc = Camera(
|
||||
hass,
|
||||
run_driver,
|
||||
"Camera",
|
||||
entity_id,
|
||||
2,
|
||||
{},
|
||||
)
|
||||
await acc.run_handler()
|
||||
|
||||
assert acc.aid == 2
|
||||
|
@ -355,7 +383,14 @@ async def test_camera_with_no_stream(hass, run_driver, events):
|
|||
|
||||
hass.states.async_set(entity_id, None)
|
||||
await hass.async_block_till_done()
|
||||
acc = Camera(hass, run_driver, "Camera", entity_id, 2, {},)
|
||||
acc = Camera(
|
||||
hass,
|
||||
run_driver,
|
||||
"Camera",
|
||||
entity_id,
|
||||
2,
|
||||
{},
|
||||
)
|
||||
await acc.run_handler()
|
||||
|
||||
assert acc.aid == 2
|
||||
|
|
|
@ -437,7 +437,10 @@ async def test_window_basic_restore(hass, hk_driver, cls, events):
|
|||
registry = await entity_registry.async_get_registry(hass)
|
||||
|
||||
registry.async_get_or_create(
|
||||
"cover", "generic", "1234", suggested_object_id="simple",
|
||||
"cover",
|
||||
"generic",
|
||||
"1234",
|
||||
suggested_object_id="simple",
|
||||
)
|
||||
registry.async_get_or_create(
|
||||
"cover",
|
||||
|
@ -472,7 +475,10 @@ async def test_window_restore(hass, hk_driver, cls, events):
|
|||
registry = await entity_registry.async_get_registry(hass)
|
||||
|
||||
registry.async_get_or_create(
|
||||
"cover", "generic", "1234", suggested_object_id="simple",
|
||||
"cover",
|
||||
"generic",
|
||||
"1234",
|
||||
suggested_object_id="simple",
|
||||
)
|
||||
registry.async_get_or_create(
|
||||
"cover",
|
||||
|
|
|
@ -566,7 +566,10 @@ async def test_fan_restore(hass, hk_driver, cls, events):
|
|||
registry = await entity_registry.async_get_registry(hass)
|
||||
|
||||
registry.async_get_or_create(
|
||||
"fan", "generic", "1234", suggested_object_id="simple",
|
||||
"fan",
|
||||
"generic",
|
||||
"1234",
|
||||
suggested_object_id="simple",
|
||||
)
|
||||
registry.async_get_or_create(
|
||||
"fan",
|
||||
|
|
|
@ -74,7 +74,9 @@ async def test_humidifier(hass, hk_driver, events):
|
|||
}
|
||||
|
||||
hass.states.async_set(
|
||||
entity_id, STATE_ON, {ATTR_HUMIDITY: 47},
|
||||
entity_id,
|
||||
STATE_ON,
|
||||
{ATTR_HUMIDITY: 47},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert acc.char_target_humidity.value == 47.0
|
||||
|
@ -153,7 +155,9 @@ async def test_dehumidifier(hass, hk_driver, events):
|
|||
}
|
||||
|
||||
hass.states.async_set(
|
||||
entity_id, STATE_ON, {ATTR_HUMIDITY: 30},
|
||||
entity_id,
|
||||
STATE_ON,
|
||||
{ATTR_HUMIDITY: 30},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert acc.char_target_humidity.value == 30.0
|
||||
|
@ -162,7 +166,9 @@ async def test_dehumidifier(hass, hk_driver, events):
|
|||
assert acc.char_active.value == 1
|
||||
|
||||
hass.states.async_set(
|
||||
entity_id, STATE_OFF, {ATTR_HUMIDITY: 42},
|
||||
entity_id,
|
||||
STATE_OFF,
|
||||
{ATTR_HUMIDITY: 42},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert acc.char_target_humidity.value == 42.0
|
||||
|
@ -204,7 +210,9 @@ async def test_hygrostat_power_state(hass, hk_driver, events):
|
|||
entity_id = "humidifier.test"
|
||||
|
||||
hass.states.async_set(
|
||||
entity_id, STATE_ON, {ATTR_HUMIDITY: 43},
|
||||
entity_id,
|
||||
STATE_ON,
|
||||
{ATTR_HUMIDITY: 43},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
acc = HumidifierDehumidifier(
|
||||
|
@ -220,7 +228,9 @@ async def test_hygrostat_power_state(hass, hk_driver, events):
|
|||
assert acc.char_active.value == 1
|
||||
|
||||
hass.states.async_set(
|
||||
entity_id, STATE_OFF, {ATTR_HUMIDITY: 43},
|
||||
entity_id,
|
||||
STATE_OFF,
|
||||
{ATTR_HUMIDITY: 43},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert acc.char_current_humidifier_dehumidifier.value == 0
|
||||
|
@ -397,9 +407,9 @@ async def test_humidifier_as_dehumidifier(hass, hk_driver, events, caplog):
|
|||
assert acc.char_target_humidifier_dehumidifier.value == 1
|
||||
|
||||
# Set from HomeKit
|
||||
char_target_humidifier_dehumidifier_iid = acc.char_target_humidifier_dehumidifier.to_HAP()[
|
||||
HAP_REPR_IID
|
||||
]
|
||||
char_target_humidifier_dehumidifier_iid = (
|
||||
acc.char_target_humidifier_dehumidifier.to_HAP()[HAP_REPR_IID]
|
||||
)
|
||||
|
||||
hk_driver.set_characteristics(
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue