mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Enable Ruff rule PT007 (#113764)
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
@@ -13,10 +13,10 @@ FAKE_UUID = "a266a680b608c32770e6c45bfe6b8411"
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"schema",
|
||||
(
|
||||
[
|
||||
{"device": None},
|
||||
{"entity": None},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_valid_base_schema(schema) -> None:
|
||||
"""Test base schema validation."""
|
||||
@@ -25,14 +25,14 @@ def test_valid_base_schema(schema) -> None:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"schema",
|
||||
(
|
||||
[
|
||||
None,
|
||||
"not_a_dict",
|
||||
{},
|
||||
{"non_existing": {}},
|
||||
# Two keys
|
||||
{"device": {}, "entity": {}},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_invalid_base_schema(schema) -> None:
|
||||
"""Test base schema validation."""
|
||||
@@ -79,7 +79,7 @@ def _test_selector(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(None, ("abc123",), (None,)),
|
||||
({}, ("abc123",), (None,)),
|
||||
({"integration": "zha"}, ("abc123",), (None,)),
|
||||
@@ -147,7 +147,7 @@ def _test_selector(
|
||||
("abc123",),
|
||||
(None,),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_device_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test device selector."""
|
||||
@@ -156,7 +156,7 @@ def test_device_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
({}, ("sensor.abc123", FAKE_UUID), (None, "abc123")),
|
||||
({"integration": "zha"}, ("sensor.abc123", FAKE_UUID), (None, "abc123")),
|
||||
({"domain": "light"}, ("light.abc123", FAKE_UUID), (None, "sensor.abc123")),
|
||||
@@ -266,7 +266,7 @@ def test_device_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
("light.abc123", "blah.blah", FAKE_UUID),
|
||||
(None,),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_entity_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test entity selector."""
|
||||
@@ -275,7 +275,7 @@ def test_entity_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"schema",
|
||||
(
|
||||
[
|
||||
# Feature should be string specifying an enum member, not an int
|
||||
{"filter": [{"supported_features": [1]}]},
|
||||
# Invalid feature
|
||||
@@ -284,7 +284,7 @@ def test_entity_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
{"filter": [{"supported_features": ["blah.FooEntityFeature.blah"]}]},
|
||||
# Unknown feature enum member
|
||||
{"filter": [{"supported_features": ["light.LightEntityFeature.blah"]}]},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_entity_selector_schema_error(schema) -> None:
|
||||
"""Test number selector."""
|
||||
@@ -294,7 +294,7 @@ def test_entity_selector_schema_error(schema) -> None:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
({}, ("abc123",), (None,)),
|
||||
({"entity": {}}, ("abc123",), (None,)),
|
||||
({"entity": {"domain": "light"}}, ("abc123",), (None,)),
|
||||
@@ -352,7 +352,7 @@ def test_entity_selector_schema_error(schema) -> None:
|
||||
((["abc123", "def456"],)),
|
||||
(None, "abc123", ["abc123", None]),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_area_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test area selector."""
|
||||
@@ -361,13 +361,13 @@ def test_area_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("23ouih2iu23ou2", "2j4hp3uy4p87wyrpiuhk34"),
|
||||
(None, True, 1),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_assist_pipeline_selector_schema(
|
||||
schema, valid_selections, invalid_selections
|
||||
@@ -378,7 +378,7 @@ def test_assist_pipeline_selector_schema(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{"min": 10, "max": 50},
|
||||
(
|
||||
@@ -398,7 +398,7 @@ def test_assist_pipeline_selector_schema(
|
||||
({"mode": "box"}, (10,), ()),
|
||||
({"mode": "box", "step": "any"}, (), ()),
|
||||
({"mode": "slider", "min": 0, "max": 1, "step": "any"}, (), ()),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_number_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test number selector."""
|
||||
@@ -407,10 +407,10 @@ def test_number_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"schema",
|
||||
(
|
||||
[
|
||||
{}, # Must have mandatory fields
|
||||
{"mode": "slider"}, # Must have min+max in slider mode
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_number_selector_schema_error(schema) -> None:
|
||||
"""Test number selector."""
|
||||
@@ -420,7 +420,7 @@ def test_number_selector_schema_error(schema) -> None:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(({}, ("abc123",), (None,)),),
|
||||
[({}, ("abc123",), (None,))],
|
||||
)
|
||||
def test_addon_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test add-on selector."""
|
||||
@@ -429,7 +429,7 @@ def test_addon_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(({}, ("abc123", "/backup"), (None, "abc@123", "abc 123", "")),),
|
||||
[({}, ("abc123", "/backup"), (None, "abc@123", "abc 123", ""))],
|
||||
)
|
||||
def test_backup_location_selector_schema(
|
||||
schema, valid_selections, invalid_selections
|
||||
@@ -440,7 +440,7 @@ def test_backup_location_selector_schema(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(({}, (1, "one", None), ()),), # Everything can be coerced to bool
|
||||
[({}, (1, "one", None), ())], # Everything can be coerced to bool
|
||||
)
|
||||
def test_boolean_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test boolean selector."""
|
||||
@@ -455,7 +455,7 @@ def test_boolean_selector_schema(schema, valid_selections, invalid_selections) -
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("6b68b250388cbe0d620c92dd3acc93ec", "76f2e8f9a6491a1b580b3a8967c27ddd"),
|
||||
@@ -466,7 +466,7 @@ def test_boolean_selector_schema(schema, valid_selections, invalid_selections) -
|
||||
("6b68b250388cbe0d620c92dd3acc93ec", "76f2e8f9a6491a1b580b3a8967c27ddd"),
|
||||
(None, True, 1),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_config_entry_selector_schema(
|
||||
schema, valid_selections, invalid_selections
|
||||
@@ -477,7 +477,7 @@ def test_config_entry_selector_schema(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("NL", "DE"),
|
||||
@@ -488,7 +488,7 @@ def test_config_entry_selector_schema(
|
||||
("NL", "DE"),
|
||||
(None, True, 1, "sv", "en"),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_country_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test country selector."""
|
||||
@@ -497,7 +497,7 @@ def test_country_selector_schema(schema, valid_selections, invalid_selections) -
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(({}, ("00:00:00",), ("blah", None)),),
|
||||
[({}, ("00:00:00",), ("blah", None))],
|
||||
)
|
||||
def test_time_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test time selector."""
|
||||
@@ -506,13 +506,13 @@ def test_time_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{"entity_id": "sensor.abc"},
|
||||
("on", "armed"),
|
||||
(None, True, 1),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_state_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test state selector."""
|
||||
@@ -521,7 +521,7 @@ def test_state_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
({}, ({"entity_id": ["sensor.abc123"]},), ("abc123", None)),
|
||||
({"entity": {}}, (), ()),
|
||||
({"entity": {"domain": "light"}}, (), ()),
|
||||
@@ -566,7 +566,7 @@ def test_state_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
(),
|
||||
(),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_target_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test target selector."""
|
||||
@@ -575,7 +575,7 @@ def test_target_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(({}, ("abc123",), ()),),
|
||||
[({}, ("abc123",), ())],
|
||||
)
|
||||
def test_action_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test action sequence selector."""
|
||||
@@ -584,7 +584,7 @@ def test_action_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(({}, ("abc123",), ()),),
|
||||
[({}, ("abc123",), ())],
|
||||
)
|
||||
def test_object_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test object selector."""
|
||||
@@ -593,7 +593,7 @@ def test_object_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
({}, ("abc123",), (None,)),
|
||||
({"multiline": True}, (), ()),
|
||||
({"multiline": False, "type": "email"}, (), ()),
|
||||
@@ -603,7 +603,7 @@ def test_object_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
(["abc123", "def456"],),
|
||||
("abc123", None, ["abc123", None]),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_text_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test text selector."""
|
||||
@@ -612,7 +612,7 @@ def test_text_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{"options": ["red", "green", "blue"]},
|
||||
("red", "green", "blue"),
|
||||
@@ -681,7 +681,7 @@ def test_text_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
("red", "blue"),
|
||||
(0, None, ["red"]),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_select_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test select selector."""
|
||||
@@ -690,14 +690,14 @@ def test_select_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"schema",
|
||||
(
|
||||
[
|
||||
{}, # Must have options
|
||||
{"options": {"hello": "World"}}, # Options must be a list
|
||||
# Options must be strings or value / label pairs
|
||||
{"options": [{"hello": "World"}]},
|
||||
# Options must all be of the same type
|
||||
{"options": ["red", {"value": "green", "label": "Emerald Green"}]},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_select_selector_schema_error(schema) -> None:
|
||||
"""Test select selector."""
|
||||
@@ -707,7 +707,7 @@ def test_select_selector_schema_error(schema) -> None:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{"entity_id": "sensor.abc"},
|
||||
("friendly_name", "device_class"),
|
||||
@@ -718,7 +718,7 @@ def test_select_selector_schema_error(schema) -> None:
|
||||
("device_class", "state_class"),
|
||||
(None,),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_attribute_selector_schema(
|
||||
schema, valid_selections, invalid_selections
|
||||
@@ -729,7 +729,7 @@ def test_attribute_selector_schema(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
(
|
||||
@@ -743,7 +743,7 @@ def test_attribute_selector_schema(
|
||||
({"seconds": 10}, {"days": 10}),
|
||||
(None, {}),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_duration_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test duration selector."""
|
||||
@@ -752,13 +752,13 @@ def test_duration_selector_schema(schema, valid_selections, invalid_selections)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("mdi:abc",),
|
||||
(None,),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_icon_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test icon selector."""
|
||||
@@ -767,7 +767,7 @@ def test_icon_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("abc",),
|
||||
@@ -778,7 +778,7 @@ def test_icon_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
("abc",),
|
||||
(None,),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_theme_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test theme selector."""
|
||||
@@ -787,7 +787,7 @@ def test_theme_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
(
|
||||
@@ -805,7 +805,7 @@ def test_theme_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
),
|
||||
(None, "abc", {}),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_media_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test media selector."""
|
||||
@@ -826,7 +826,7 @@ def test_media_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("nl", "fr"),
|
||||
@@ -837,7 +837,7 @@ def test_media_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
("nl", "fr"),
|
||||
(None, True, 1, "de", "en"),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_language_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test language selector."""
|
||||
@@ -846,7 +846,7 @@ def test_language_selector_schema(schema, valid_selections, invalid_selections)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
(
|
||||
@@ -873,7 +873,7 @@ def test_language_selector_schema(schema, valid_selections, invalid_selections)
|
||||
{"longitude": 1.0},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_location_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test location selector."""
|
||||
@@ -883,13 +883,13 @@ def test_location_selector_schema(schema, valid_selections, invalid_selections)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
([0, 0, 0], [255, 255, 255], [0.0, 0.0, 0.0], [255.0, 255.0, 255.0]),
|
||||
(None, "abc", [0, 0, "nil"], (255, 255, 255)),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_rgb_color_selector_schema(
|
||||
schema, valid_selections, invalid_selections
|
||||
@@ -901,7 +901,7 @@ def test_rgb_color_selector_schema(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
(100, 100.0),
|
||||
@@ -922,7 +922,7 @@ def test_rgb_color_selector_schema(
|
||||
(1000, 2000),
|
||||
(999, 2001),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_color_tempselector_schema(
|
||||
schema, valid_selections, invalid_selections
|
||||
@@ -934,13 +934,13 @@ def test_color_tempselector_schema(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("2022-03-24",),
|
||||
(None, "abc", "00:00", "2022-03-24 00:00", "2022-03-32"),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_date_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test date selector."""
|
||||
@@ -950,13 +950,13 @@ def test_date_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("2022-03-24 00:00", "2022-03-24"),
|
||||
(None, "abc", "00:00", "2022-03-24 24:01"),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_datetime_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test datetime selector."""
|
||||
@@ -966,7 +966,7 @@ def test_datetime_selector_schema(schema, valid_selections, invalid_selections)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(({}, ("abc123", "{{ now() }}"), (None, "{{ incomplete }", "{% if True %}Hi!")),),
|
||||
[({}, ("abc123", "{{ now() }}"), (None, "{{ incomplete }", "{% if True %}Hi!"))],
|
||||
)
|
||||
def test_template_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test template selector."""
|
||||
@@ -975,13 +975,13 @@ def test_template_selector_schema(schema, valid_selections, invalid_selections)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{"accept": "image/*"},
|
||||
("0182a1b99dbc5ae24aecd90c346605fa",),
|
||||
(None, "not-a-uuid", "abcd", 1),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_file_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test file selector."""
|
||||
@@ -991,7 +991,7 @@ def test_file_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{"value": True, "label": "Blah"},
|
||||
(True, 1),
|
||||
@@ -1022,7 +1022,7 @@ def test_file_selector_schema(schema, valid_selections, invalid_selections) -> N
|
||||
("dog",),
|
||||
(None, False, True, 0, 1, "abc", "def"),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_constant_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test constant selector."""
|
||||
@@ -1031,11 +1031,11 @@ def test_constant_selector_schema(schema, valid_selections, invalid_selections)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"schema",
|
||||
(
|
||||
[
|
||||
{}, # Value is mandatory
|
||||
{"value": []}, # Value must be str, int or bool
|
||||
{"value": 123, "label": 123}, # Label must be str
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_constant_selector_schema_error(schema) -> None:
|
||||
"""Test constant selector."""
|
||||
@@ -1045,7 +1045,7 @@ def test_constant_selector_schema_error(schema) -> None:
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
("home_assistant", "2j4hp3uy4p87wyrpiuhk34"),
|
||||
@@ -1056,7 +1056,7 @@ def test_constant_selector_schema_error(schema) -> None:
|
||||
("home_assistant", "2j4hp3uy4p87wyrpiuhk34"),
|
||||
(None, True, 1),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_conversation_agent_selector_schema(
|
||||
schema, valid_selections, invalid_selections
|
||||
@@ -1067,7 +1067,7 @@ def test_conversation_agent_selector_schema(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
(
|
||||
@@ -1082,7 +1082,7 @@ def test_conversation_agent_selector_schema(
|
||||
),
|
||||
("abc"),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_condition_selector_schema(
|
||||
schema, valid_selections, invalid_selections
|
||||
@@ -1093,7 +1093,7 @@ def test_condition_selector_schema(
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{},
|
||||
(
|
||||
@@ -1108,7 +1108,7 @@ def test_condition_selector_schema(
|
||||
),
|
||||
("abc"),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_trigger_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test trigger sequence selector."""
|
||||
@@ -1117,7 +1117,7 @@ def test_trigger_selector_schema(schema, valid_selections, invalid_selections) -
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("schema", "valid_selections", "invalid_selections"),
|
||||
(
|
||||
[
|
||||
(
|
||||
{"data": "test", "scale": 5},
|
||||
("test",),
|
||||
@@ -1137,7 +1137,7 @@ def test_trigger_selector_schema(schema, valid_selections, invalid_selections) -
|
||||
("test",),
|
||||
(True, 1, []),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_qr_code_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
"""Test QR code selector."""
|
||||
|
||||
Reference in New Issue
Block a user