Break long strings in Google generative ai conversation (#109771)

* Update test_init.py

* Update __init__.py
pull/109793/head
tronikos 2024-02-06 01:50:58 -08:00 committed by GitHub
parent f8862f64a1
commit d4c235622f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -63,7 +63,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
for image_filename in image_filenames:
if not hass.config.is_allowed_path(image_filename):
raise HomeAssistantError(
f"Cannot read `{image_filename}`, no access to path; `allowlist_external_dirs` may need to be adjusted in `configuration.yaml`"
f"Cannot read `{image_filename}`, no access to path; "
"`allowlist_external_dirs` may need to be adjusted in "
"`configuration.yaml`"
)
if not Path(image_filename).exists():
raise HomeAssistantError(f"`{image_filename}` does not exist")

View File

@ -163,7 +163,7 @@ async def test_generate_content_service_without_images(
"""Test generate content service."""
stubbed_generated_content = (
"I'm thrilled to welcome you all to the release "
+ "party for the latest version of Home Assistant!"
"party for the latest version of Home Assistant!"
)
with patch("google.generativeai.GenerativeModel") as mock_model:
@ -257,7 +257,11 @@ async def test_generate_content_service_with_image_not_allowed_path(
hass.config, "is_allowed_path", return_value=False
), pytest.raises(
HomeAssistantError,
match="Cannot read `doorbell_snapshot.jpg`, no access to path; `allowlist_external_dirs` may need to be adjusted in `configuration.yaml`",
match=(
"Cannot read `doorbell_snapshot.jpg`, no access to path; "
"`allowlist_external_dirs` may need to be adjusted in "
"`configuration.yaml`"
),
):
await hass.services.async_call(
"google_generative_ai_conversation",