Break long strings in Google generative ai conversation (#109771)
* Update test_init.py * Update __init__.pypull/109793/head
parent
f8862f64a1
commit
d4c235622f
|
@ -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")
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue