Update byte string formatting (2) (#114039)

This commit is contained in:
Marc Mueller 2024-03-23 00:22:15 +01:00 committed by GitHub
parent 596ddbb6eb
commit 1dbc94162d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 19 deletions

View file

@ -136,9 +136,9 @@ def valid_topic(topic: Any) -> str:
) )
if "\0" in validated_topic: if "\0" in validated_topic:
raise vol.Invalid("MQTT topic name/filter must not contain null character.") raise vol.Invalid("MQTT topic name/filter must not contain null character.")
if any(char <= "\u001F" for char in validated_topic): if any(char <= "\u001f" for char in validated_topic):
raise vol.Invalid("MQTT topic name/filter must not contain control characters.") raise vol.Invalid("MQTT topic name/filter must not contain control characters.")
if any("\u007f" <= char <= "\u009F" for char in validated_topic): if any("\u007f" <= char <= "\u009f" for char in validated_topic):
raise vol.Invalid("MQTT topic name/filter must not contain control characters.") raise vol.Invalid("MQTT topic name/filter must not contain control characters.")
if any("\ufdd0" <= char <= "\ufdef" for char in validated_topic): if any("\ufdd0" <= char <= "\ufdef" for char in validated_topic):
raise vol.Invalid("MQTT topic name/filter must not contain non-characters.") raise vol.Invalid("MQTT topic name/filter must not contain non-characters.")

View file

@ -204,9 +204,9 @@ async def test_rfy_cover(hass: HomeAssistant, rfxtrx) -> None:
) )
assert rfxtrx.transport.send.mock_calls == [ assert rfxtrx.transport.send.mock_calls == [
call(bytearray(b"\x0C\x1a\x00\x00\x01\x02\x03\x01\x00\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x00\x01\x02\x03\x01\x00\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x01\x01\x02\x03\x01\x01\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x01\x01\x02\x03\x01\x01\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x02\x01\x02\x03\x01\x03\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x02\x01\x02\x03\x01\x03\x00\x00\x00\x00")),
] ]
# Test a blind with venetian mode set to US # Test a blind with venetian mode set to US
@ -257,12 +257,12 @@ async def test_rfy_cover(hass: HomeAssistant, rfxtrx) -> None:
) )
assert rfxtrx.transport.send.mock_calls == [ assert rfxtrx.transport.send.mock_calls == [
call(bytearray(b"\x0C\x1a\x00\x00\x01\x02\x03\x02\x00\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x00\x01\x02\x03\x02\x00\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x01\x01\x02\x03\x02\x0F\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x01\x01\x02\x03\x02\x0f\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x02\x01\x02\x03\x02\x10\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x02\x01\x02\x03\x02\x10\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x03\x01\x02\x03\x02\x11\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x03\x01\x02\x03\x02\x11\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x04\x01\x02\x03\x02\x12\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x04\x01\x02\x03\x02\x12\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x00\x01\x02\x03\x02\x00\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x00\x01\x02\x03\x02\x00\x00\x00\x00\x00")),
] ]
# Test a blind with venetian mode set to EU # Test a blind with venetian mode set to EU
@ -313,10 +313,10 @@ async def test_rfy_cover(hass: HomeAssistant, rfxtrx) -> None:
) )
assert rfxtrx.transport.send.mock_calls == [ assert rfxtrx.transport.send.mock_calls == [
call(bytearray(b"\x0C\x1a\x00\x00\x01\x02\x03\x03\x00\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x00\x01\x02\x03\x03\x00\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x01\x01\x02\x03\x03\x11\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x01\x01\x02\x03\x03\x11\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x02\x01\x02\x03\x03\x12\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x02\x01\x02\x03\x03\x12\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x03\x01\x02\x03\x03\x0F\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x03\x01\x02\x03\x03\x0f\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x04\x01\x02\x03\x03\x10\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x04\x01\x02\x03\x03\x10\x00\x00\x00\x00")),
call(bytearray(b"\x0C\x1a\x00\x00\x01\x02\x03\x03\x00\x00\x00\x00\x00")), call(bytearray(b"\x0c\x1a\x00\x00\x01\x02\x03\x03\x00\x00\x00\x00\x00")),
] ]

View file

@ -54,7 +54,7 @@ async def test_application_state(
"Home", "Home",
"Amazon Video on Demand", "Amazon Video on Demand",
"Free FrameChannel Service", "Free FrameChannel Service",
"MLB.TV" + "\u00AE", "MLB.TV" + "\u00ae",
"Mediafly", "Mediafly",
"Netflix", "Netflix",
"Pandora", "Pandora",

View file

@ -522,7 +522,7 @@ async def test_if_fires_on_motion_detected(hass: HomeAssistant, calls) -> None:
# Creates the device in the registry # Creates the device in the registry
inject_bluetooth_service_info_bleak( inject_bluetooth_service_info_bleak(
hass, hass,
make_advertisement(mac, b"@0\xdd\x03$\x0A\x10\x01\x64"), make_advertisement(mac, b"@0\xdd\x03$\x0a\x10\x01\x64"),
) )
# wait for the device being created # wait for the device being created