mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Strip trailing spaces from HomeKit names (#131971)
This commit is contained in:
parent
0d155c416a
commit
e8ef990e72
@ -114,7 +114,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
NUMBERS_ONLY_RE = re.compile(r"[^\d.]+")
|
||||
VERSION_RE = re.compile(r"([0-9]+)(\.[0-9]+)?(\.[0-9]+)?")
|
||||
INVALID_END_CHARS = "-_"
|
||||
INVALID_END_CHARS = "-_ "
|
||||
MAX_VERSION_PART = 2**32 - 1
|
||||
|
||||
|
||||
|
@ -121,7 +121,7 @@ async def test_home_accessory(hass: HomeAssistant, hk_driver) -> None:
|
||||
serv = acc3.services[0] # SERV_ACCESSORY_INFO
|
||||
assert (
|
||||
serv.get_characteristic(CHAR_NAME).value
|
||||
== "Home Accessory that exceeds the maximum maximum maximum maximum "
|
||||
== "Home Accessory that exceeds the maximum maximum maximum maximum"
|
||||
)
|
||||
assert (
|
||||
serv.get_characteristic(CHAR_MANUFACTURER).value
|
||||
@ -154,7 +154,7 @@ async def test_home_accessory(hass: HomeAssistant, hk_driver) -> None:
|
||||
serv = acc4.services[0] # SERV_ACCESSORY_INFO
|
||||
assert (
|
||||
serv.get_characteristic(CHAR_NAME).value
|
||||
== "Home Accessory that exceeds the maximum maximum maximum maximum "
|
||||
== "Home Accessory that exceeds the maximum maximum maximum maximum"
|
||||
)
|
||||
assert (
|
||||
serv.get_characteristic(CHAR_MANUFACTURER).value
|
||||
|
@ -256,6 +256,7 @@ def test_cleanup_name_for_homekit() -> None:
|
||||
"""Ensure name sanitize works as expected."""
|
||||
|
||||
assert cleanup_name_for_homekit("abc") == "abc"
|
||||
assert cleanup_name_for_homekit("abc ") == "abc"
|
||||
assert cleanup_name_for_homekit("a b c") == "a b c"
|
||||
assert cleanup_name_for_homekit("ab_c") == "ab c"
|
||||
assert (
|
||||
|
Loading…
x
Reference in New Issue
Block a user