Fix placeholder quotes (#114974)

* When quoting placeholders, always use double quotes so Lokalise recognizes the placeholder.

* Ensure that strings does not contain placeholders in single quotes.

* Avoid redefining value

* Moved string_with_no_placeholders_in_single_quotes

* Define regex once

* Fix tests
This commit is contained in:
Øyvind Matheson Wergeland 2024-04-06 13:01:56 +02:00 committed by GitHub
parent bd9070be11
commit fdef3ece13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 51 additions and 18 deletions

View file

@ -68,7 +68,7 @@ async def test_rest_command_timeout(
with pytest.raises(HomeAssistantError) as exc:
await hass.services.async_call(DOMAIN, "get_test", {}, blocking=True)
assert str(exc.value) == "Timeout when calling resource 'https://example.com/'"
assert str(exc.value) == 'Timeout when calling resource "https://example.com/"'
assert len(aioclient_mock.mock_calls) == 1
@ -88,7 +88,7 @@ async def test_rest_command_aiohttp_error(
assert (
str(exc.value)
== "Client error occurred when calling resource 'https://example.com/'"
== 'Client error occurred when calling resource "https://example.com/"'
)
assert len(aioclient_mock.mock_calls) == 1
@ -341,7 +341,7 @@ async def test_rest_command_get_response_malformed_json(
)
assert (
str(exc.value)
== "The response of 'https://example.com/' could not be decoded as JSON"
== 'The response of "https://example.com/" could not be decoded as JSON'
)
@ -375,7 +375,7 @@ async def test_rest_command_get_response_none(
)
assert (
str(exc.value)
== "The response of 'https://example.com/' could not be decoded as text"
== 'The response of "https://example.com/" could not be decoded as text'
)
assert not response