Code styling tweaks to the tests - Part 1 (#86192)

This commit is contained in:
Franck Nijhof 2023-01-20 13:52:46 +01:00 committed by GitHub
parent 79b52a2b41
commit 24fdd588fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 552 additions and 251 deletions

View file

@ -144,8 +144,10 @@ async def test_update_with_json_attrs(hass: HomeAssistant) -> None:
await setup_test_entities(
hass,
{
"command": 'echo { \\"key\\": \\"some_json_value\\", \\"another_key\\":\
\\"another_json_value\\", \\"key_three\\": \\"value_three\\" }',
"command": (
'echo { \\"key\\": \\"some_json_value\\", \\"another_key\\": '
'\\"another_json_value\\", \\"key_three\\": \\"value_three\\" }'
),
"json_attributes": ["key", "another_key", "key_three"],
},
)
@ -218,8 +220,10 @@ async def test_update_with_missing_json_attrs(
await setup_test_entities(
hass,
{
"command": 'echo { \\"key\\": \\"some_json_value\\", \\"another_key\\":\
\\"another_json_value\\", \\"key_three\\": \\"value_three\\" }',
"command": (
'echo { \\"key\\": \\"some_json_value\\", \\"another_key\\": '
'\\"another_json_value\\", \\"key_three\\": \\"value_three\\" }'
),
"json_attributes": ["key", "another_key", "key_three", "missing_key"],
},
)
@ -239,8 +243,10 @@ async def test_update_with_unnecessary_json_attrs(
await setup_test_entities(
hass,
{
"command": 'echo { \\"key\\": \\"some_json_value\\", \\"another_key\\":\
\\"another_json_value\\", \\"key_three\\": \\"value_three\\" }',
"command": (
'echo { \\"key\\": \\"some_json_value\\", \\"another_key\\": '
'\\"another_json_value\\", \\"key_three\\": \\"value_three\\" }'
),
"json_attributes": ["key", "another_key"],
},
)

View file

@ -93,7 +93,9 @@ async def test_state_value(hass: HomeAssistant) -> None:
"command_on": f"echo 1 > {path}",
"command_off": f"echo 0 > {path}",
"value_template": '{{ value=="1" }}',
"icon_template": '{% if value=="1" %} mdi:on {% else %} mdi:off {% endif %}',
"icon_template": (
'{% if value=="1" %} mdi:on {% else %} mdi:off {% endif %}'
),
}
},
)
@ -142,7 +144,10 @@ async def test_state_json_value(hass: HomeAssistant) -> None:
"command_on": f"echo '{oncmd}' > {path}",
"command_off": f"echo '{offcmd}' > {path}",
"value_template": '{{ value_json.status=="ok" }}',
"icon_template": '{% if value_json.status=="ok" %} mdi:on {% else %} mdi:off {% endif %}',
"icon_template": (
'{% if value_json.status=="ok" %} mdi:on'
"{% else %} mdi:off {% endif %}"
),
}
},
)