mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 18:58:04 +02:00
Correct type hints on MQTT tests (#128299)
This commit is contained in:
@ -482,7 +482,7 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
assert state.state == STATE_ON
|
||||
|
||||
# Full brightness - no scaling of RGB values sent over MQTT
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[255, 128, 0])
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=(255, 128, 0))
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set", "on,,,255-128-0,30.118-100.0", 2, False
|
||||
)
|
||||
@ -492,7 +492,7 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
assert state.attributes.get("rgb_color") == (255, 128, 0)
|
||||
|
||||
# Full brightness - normalization of RGB values sent over MQTT
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[128, 64, 0])
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=(128, 64, 0))
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set", "on,,,255-127-0,30.0-100.0", 2, False
|
||||
)
|
||||
@ -511,7 +511,7 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
assert state.state == STATE_ON
|
||||
|
||||
# Half brightness - scaling of RGB values sent over MQTT
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[0, 255, 128])
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=(0, 255, 128))
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set", "on,,,0-128-64,150.118-100.0", 2, False
|
||||
)
|
||||
@ -521,7 +521,7 @@ async def test_sending_mqtt_commands_and_optimistic(
|
||||
assert state.attributes.get("rgb_color") == (0, 255, 128)
|
||||
|
||||
# Half brightness - normalization+scaling of RGB values sent over MQTT
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[0, 32, 16])
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=(0, 32, 16))
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set", "on,,,0-128-64,150.0-100.0", 2, False
|
||||
)
|
||||
@ -614,7 +614,7 @@ async def test_sending_mqtt_commands_non_optimistic_brightness_template(
|
||||
assert not state.attributes.get("brightness")
|
||||
|
||||
# Full brightness - no scaling of RGB values sent over MQTT
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[255, 128, 0])
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=(255, 128, 0))
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set", "on,,,255-128-0,30.118-100.0", 0, False
|
||||
)
|
||||
@ -624,7 +624,7 @@ async def test_sending_mqtt_commands_non_optimistic_brightness_template(
|
||||
assert not state.attributes.get("rgb_color")
|
||||
|
||||
# Full brightness - normalization of RGB values sent over MQTT
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[128, 64, 0])
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=(128, 64, 0))
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set", "on,,,255-127-0,30.0-100.0", 0, False
|
||||
)
|
||||
@ -638,7 +638,7 @@ async def test_sending_mqtt_commands_non_optimistic_brightness_template(
|
||||
mqtt_mock.async_publish.reset_mock()
|
||||
|
||||
# Half brightness - no scaling of RGB values sent over MQTT
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[0, 255, 128])
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=(0, 255, 128))
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set", "on,,,0-255-128,150.118-100.0", 0, False
|
||||
)
|
||||
@ -646,7 +646,7 @@ async def test_sending_mqtt_commands_non_optimistic_brightness_template(
|
||||
state = hass.states.get("light.test")
|
||||
|
||||
# Half brightness - normalization but no scaling of RGB values sent over MQTT
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=[0, 32, 16])
|
||||
await common.async_turn_on(hass, "light.test", rgb_color=(0, 32, 16))
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"test_light_rgb/set", "on,,,0-255-127,150.0-100.0", 0, False
|
||||
)
|
||||
@ -1259,7 +1259,7 @@ async def test_publishing_with_custom_encoding(
|
||||
) -> None:
|
||||
"""Test publishing MQTT payload with different encoding."""
|
||||
domain = light.DOMAIN
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
config: dict[str, Any] = copy.deepcopy(DEFAULT_CONFIG)
|
||||
if topic == "effect_command_topic":
|
||||
config[mqtt.DOMAIN][domain]["effect_list"] = ["random", "color_loop"]
|
||||
|
||||
|
Reference in New Issue
Block a user