Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
TestVultrSwitchSetup.add_entities | (self, devices, action) | Mock add devices. | Mock add devices. | def add_entities(self, devices, action):
"""Mock add devices."""
for device in devices:
self.DEVICES.append(device) | [
"def",
"add_entities",
"(",
"self",
",",
"devices",
",",
"action",
")",
":",
"for",
"device",
"in",
"devices",
":",
"self",
".",
"DEVICES",
".",
"append",
"(",
"device",
")"
] | [
31,
4
] | [
34,
39
] | python | en | ['es', 'en', 'en'] | True |
TestVultrSwitchSetup.setUp | (self) | Init values for this testcase class. | Init values for this testcase class. | def setUp(self):
"""Init values for this testcase class."""
self.hass = get_test_home_assistant()
self.configs = [
{CONF_SUBSCRIPTION: "576965", CONF_NAME: "A Server"},
{CONF_SUBSCRIPTION: "123456", CONF_NAME: "Failed Server"},
{CONF_SUBSCRIPTION: "555555", CO... | [
"def",
"setUp",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"self",
".",
"configs",
"=",
"[",
"{",
"CONF_SUBSCRIPTION",
":",
"\"576965\"",
",",
"CONF_NAME",
":",
"\"A Server\"",
"}",
",",
"{",
"CONF_SUBSCRIPTION",
... | [
36,
4
] | [
44,
47
] | python | en | ['en', 'en', 'en'] | True |
TestVultrSwitchSetup.tear_down_cleanup | (self) | Stop our started services. | Stop our started services. | def tear_down_cleanup(self):
"""Stop our started services."""
self.hass.stop() | [
"def",
"tear_down_cleanup",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
46,
4
] | [
48,
24
] | python | en | ['de', 'en', 'en'] | True |
TestVultrSwitchSetup.test_switch | (self, mock) | Test successful instance. | Test successful instance. | def test_switch(self, mock):
"""Test successful instance."""
mock.get(
"https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567",
text=load_fixture("vultr_account_info.json"),
)
with patch(
"vultr.Vultr.server_list",
return_value=json... | [
"def",
"test_switch",
"(",
"self",
",",
"mock",
")",
":",
"mock",
".",
"get",
"(",
"\"https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567\"",
",",
"text",
"=",
"load_fixture",
"(",
"\"vultr_account_info.json\"",
")",
",",
")",
"with",
"patch",
"(",
"\"vultr... | [
51,
4
] | [
109,
26
] | python | en | ['en', 'ro', 'en'] | True |
TestVultrSwitchSetup.test_turn_on | (self, mock) | Test turning a subscription on. | Test turning a subscription on. | def test_turn_on(self, mock):
"""Test turning a subscription on."""
with patch(
"vultr.Vultr.server_list",
return_value=json.loads(load_fixture("vultr_server_list.json")),
), patch("vultr.Vultr.server_start") as mock_start:
for device in self.DEVICES:
... | [
"def",
"test_turn_on",
"(",
"self",
",",
"mock",
")",
":",
"with",
"patch",
"(",
"\"vultr.Vultr.server_list\"",
",",
"return_value",
"=",
"json",
".",
"loads",
"(",
"load_fixture",
"(",
"\"vultr_server_list.json\"",
")",
")",
",",
")",
",",
"patch",
"(",
"\"... | [
112,
4
] | [
123,
41
] | python | en | ['en', 'en', 'en'] | True |
TestVultrSwitchSetup.test_turn_off | (self, mock) | Test turning a subscription off. | Test turning a subscription off. | def test_turn_off(self, mock):
"""Test turning a subscription off."""
with patch(
"vultr.Vultr.server_list",
return_value=json.loads(load_fixture("vultr_server_list.json")),
), patch("vultr.Vultr.server_halt") as mock_halt:
for device in self.DEVICES:
... | [
"def",
"test_turn_off",
"(",
"self",
",",
"mock",
")",
":",
"with",
"patch",
"(",
"\"vultr.Vultr.server_list\"",
",",
"return_value",
"=",
"json",
".",
"loads",
"(",
"load_fixture",
"(",
"\"vultr_server_list.json\"",
")",
")",
",",
")",
",",
"patch",
"(",
"\... | [
126,
4
] | [
137,
40
] | python | en | ['en', 'en', 'en'] | True |
TestVultrSwitchSetup.test_invalid_switch_config | (self) | Test config type failures. | Test config type failures. | def test_invalid_switch_config(self):
"""Test config type failures."""
with pytest.raises(vol.Invalid): # No subscription
vultr.PLATFORM_SCHEMA({CONF_PLATFORM: base_vultr.DOMAIN}) | [
"def",
"test_invalid_switch_config",
"(",
"self",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"vol",
".",
"Invalid",
")",
":",
"# No subscription",
"vultr",
".",
"PLATFORM_SCHEMA",
"(",
"{",
"CONF_PLATFORM",
":",
"base_vultr",
".",
"DOMAIN",
"}",
")"
] | [
139,
4
] | [
142,
69
] | python | en | ['en', 'en', 'en'] | True |
TestVultrSwitchSetup.test_invalid_switches | (self, mock) | Test the VultrSwitch fails. | Test the VultrSwitch fails. | def test_invalid_switches(self, mock):
"""Test the VultrSwitch fails."""
mock.get(
"https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567",
text=load_fixture("vultr_account_info.json"),
)
with patch(
"vultr.Vultr.server_list",
retur... | [
"def",
"test_invalid_switches",
"(",
"self",
",",
"mock",
")",
":",
"mock",
".",
"get",
"(",
"\"https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567\"",
",",
"text",
"=",
"load_fixture",
"(",
"\"vultr_account_info.json\"",
")",
",",
")",
"with",
"patch",
"(",
... | [
145,
4
] | [
176,
43
] | python | en | ['en', 'en', 'en'] | True |
test_setup_group_with_mixed_groupable_states | (hass) | Try to set up a group with mixed groupable states. | Try to set up a group with mixed groupable states. | async def test_setup_group_with_mixed_groupable_states(hass):
"""Try to set up a group with mixed groupable states."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("device_tracker.Paulus", STATE_HOME)
assert await async_setup_component(hass, "group", {})
await group.Group.a... | [
"async",
"def",
"test_setup_group_with_mixed_groupable_states",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"device_tracker.Paulus\"",
",",
"STATE_HOME",... | [
26,
0
] | [
40,
80
] | python | en | ['en', 'en', 'en'] | True |
test_setup_group_with_a_non_existing_state | (hass) | Try to set up a group with a non existing state. | Try to set up a group with a non existing state. | async def test_setup_group_with_a_non_existing_state(hass):
"""Try to set up a group with a non existing state."""
hass.states.async_set("light.Bowl", STATE_ON)
assert await async_setup_component(hass, "group", {})
grp = await group.Group.async_create_group(
hass, "light_and_nothing", ["light.... | [
"async",
"def",
"test_setup_group_with_a_non_existing_state",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"}",
"... | [
43,
0
] | [
53,
32
] | python | en | ['en', 'en', 'en'] | True |
test_setup_group_with_non_groupable_states | (hass) | Test setup with groups which are not groupable. | Test setup with groups which are not groupable. | async def test_setup_group_with_non_groupable_states(hass):
"""Test setup with groups which are not groupable."""
hass.states.async_set("cast.living_room", "Plex")
hass.states.async_set("cast.bedroom", "Netflix")
assert await async_setup_component(hass, "group", {})
grp = await group.Group.async_c... | [
"async",
"def",
"test_setup_group_with_non_groupable_states",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"cast.living_room\"",
",",
"\"Plex\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"cast.bedroom\"",
",",
"\"Netflix\"",
"... | [
56,
0
] | [
67,
28
] | python | en | ['en', 'en', 'en'] | True |
test_setup_empty_group | (hass) | Try to set up an empty group. | Try to set up an empty group. | async def test_setup_empty_group(hass):
"""Try to set up an empty group."""
grp = await group.Group.async_create_group(hass, "nothing", [])
assert grp.state is None | [
"async",
"def",
"test_setup_empty_group",
"(",
"hass",
")",
":",
"grp",
"=",
"await",
"group",
".",
"Group",
".",
"async_create_group",
"(",
"hass",
",",
"\"nothing\"",
",",
"[",
"]",
")",
"assert",
"grp",
".",
"state",
"is",
"None"
] | [
70,
0
] | [
74,
28
] | python | en | ['en', 'en', 'en'] | True |
test_monitor_group | (hass) | Test if the group keeps track of states. | Test if the group keeps track of states. | async def test_monitor_group(hass):
"""Test if the group keeps track of states."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = await group.Group.async_create_group(
hass, ... | [
"async",
"def",
"test_monitor_group",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"assert",
"await",
"a... | [
77,
0
] | [
93,
54
] | python | en | ['en', 'en', 'en'] | True |
test_group_turns_off_if_all_off | (hass) | Test if turn off if the last device that was on turns off. | Test if turn off if the last device that was on turns off. | async def test_group_turns_off_if_all_off(hass):
"""Test if turn off if the last device that was on turns off."""
hass.states.async_set("light.Bowl", STATE_OFF)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = await group.Group.as... | [
"async",
"def",
"test_group_turns_off_if_all_off",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_OFF",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"assert",
... | [
96,
0
] | [
110,
41
] | python | en | ['en', 'en', 'en'] | True |
test_group_turns_on_if_all_are_off_and_one_turns_on | (hass) | Test if turn on if all devices were turned off and one turns on. | Test if turn on if all devices were turned off and one turns on. | async def test_group_turns_on_if_all_are_off_and_one_turns_on(hass):
"""Test if turn on if all devices were turned off and one turns on."""
hass.states.async_set("light.Bowl", STATE_OFF)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_gr... | [
"async",
"def",
"test_group_turns_on_if_all_are_off_and_one_turns_on",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_OFF",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
... | [
113,
0
] | [
129,
40
] | python | en | ['en', 'en', 'en'] | True |
test_allgroup_stays_off_if_all_are_off_and_one_turns_on | (hass) | Group with all: true, stay off if one device turns on. | Group with all: true, stay off if one device turns on. | async def test_allgroup_stays_off_if_all_are_off_and_one_turns_on(hass):
"""Group with all: true, stay off if one device turns on."""
hass.states.async_set("light.Bowl", STATE_OFF)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = ... | [
"async",
"def",
"test_allgroup_stays_off_if_all_are_off_and_one_turns_on",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_OFF",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OF... | [
132,
0
] | [
148,
41
] | python | en | ['en', 'en', 'en'] | True |
test_allgroup_turn_on_if_last_turns_on | (hass) | Group with all: true, turn on if all devices are on. | Group with all: true, turn on if all devices are on. | async def test_allgroup_turn_on_if_last_turns_on(hass):
"""Group with all: true, turn on if all devices are on."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = await group.Group.as... | [
"async",
"def",
"test_allgroup_turn_on_if_last_turns_on",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"asse... | [
151,
0
] | [
167,
40
] | python | en | ['en', 'en', 'en'] | True |
test_expand_entity_ids | (hass) | Test expand_entity_ids method. | Test expand_entity_ids method. | async def test_expand_entity_ids(hass):
"""Test expand_entity_ids method."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = await group.Group.async_create_group(
hass, "init_... | [
"async",
"def",
"test_expand_entity_ids",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"assert",
"await",
... | [
170,
0
] | [
183,
5
] | python | en | ['de', 'en', 'en'] | True |
test_expand_entity_ids_does_not_return_duplicates | (hass) | Test that expand_entity_ids does not return duplicates. | Test that expand_entity_ids does not return duplicates. | async def test_expand_entity_ids_does_not_return_duplicates(hass):
"""Test that expand_entity_ids does not return duplicates."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = await ... | [
"async",
"def",
"test_expand_entity_ids_does_not_return_duplicates",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
"... | [
186,
0
] | [
203,
5
] | python | en | ['en', 'en', 'en'] | True |
test_expand_entity_ids_recursive | (hass) | Test expand_entity_ids method with a group that contains itself. | Test expand_entity_ids method with a group that contains itself. | async def test_expand_entity_ids_recursive(hass):
"""Test expand_entity_ids method with a group that contains itself."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = await group.Gr... | [
"async",
"def",
"test_expand_entity_ids_recursive",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"assert",
... | [
206,
0
] | [
222,
5
] | python | en | ['en', 'en', 'en'] | True |
test_expand_entity_ids_ignores_non_strings | (hass) | Test that non string elements in lists are ignored. | Test that non string elements in lists are ignored. | async def test_expand_entity_ids_ignores_non_strings(hass):
"""Test that non string elements in lists are ignored."""
assert [] == group.expand_entity_ids(hass, [5, True]) | [
"async",
"def",
"test_expand_entity_ids_ignores_non_strings",
"(",
"hass",
")",
":",
"assert",
"[",
"]",
"==",
"group",
".",
"expand_entity_ids",
"(",
"hass",
",",
"[",
"5",
",",
"True",
"]",
")"
] | [
225,
0
] | [
227,
57
] | python | en | ['en', 'en', 'en'] | True |
test_get_entity_ids | (hass) | Test get_entity_ids method. | Test get_entity_ids method. | async def test_get_entity_ids(hass):
"""Test get_entity_ids method."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = await group.Group.async_create_group(
hass, "init_group"... | [
"async",
"def",
"test_get_entity_ids",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"assert",
"await",
"... | [
230,
0
] | [
243,
5
] | python | da | ['nl', 'da', 'en'] | False |
test_get_entity_ids_with_domain_filter | (hass) | Test if get_entity_ids works with a domain_filter. | Test if get_entity_ids works with a domain_filter. | async def test_get_entity_ids_with_domain_filter(hass):
"""Test if get_entity_ids works with a domain_filter."""
hass.states.async_set("switch.AC", STATE_OFF)
assert await async_setup_component(hass, "group", {})
mixed_group = await group.Group.async_create_group(
hass, "mixed_group", ["light.... | [
"async",
"def",
"test_get_entity_ids_with_domain_filter",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"switch.AC\"",
",",
"STATE_OFF",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"}",
")",
... | [
246,
0
] | [
258,
5
] | python | en | ['en', 'en', 'en'] | True |
test_get_entity_ids_with_non_existing_group_name | (hass) | Test get_entity_ids with a non existing group. | Test get_entity_ids with a non existing group. | async def test_get_entity_ids_with_non_existing_group_name(hass):
"""Test get_entity_ids with a non existing group."""
assert [] == group.get_entity_ids(hass, "non_existing") | [
"async",
"def",
"test_get_entity_ids_with_non_existing_group_name",
"(",
"hass",
")",
":",
"assert",
"[",
"]",
"==",
"group",
".",
"get_entity_ids",
"(",
"hass",
",",
"\"non_existing\"",
")"
] | [
261,
0
] | [
263,
59
] | python | en | ['en', 'en', 'en'] | True |
test_get_entity_ids_with_non_group_state | (hass) | Test get_entity_ids with a non group state. | Test get_entity_ids with a non group state. | async def test_get_entity_ids_with_non_group_state(hass):
"""Test get_entity_ids with a non group state."""
assert [] == group.get_entity_ids(hass, "switch.AC") | [
"async",
"def",
"test_get_entity_ids_with_non_group_state",
"(",
"hass",
")",
":",
"assert",
"[",
"]",
"==",
"group",
".",
"get_entity_ids",
"(",
"hass",
",",
"\"switch.AC\"",
")"
] | [
266,
0
] | [
268,
56
] | python | en | ['en', 'en', 'en'] | True |
test_group_being_init_before_first_tracked_state_is_set_to_on | (hass) | Test if the groups turn on.
If no states existed and now a state it is tracking is being added
as ON.
| Test if the groups turn on. | async def test_group_being_init_before_first_tracked_state_is_set_to_on(hass):
"""Test if the groups turn on.
If no states existed and now a state it is tracking is being added
as ON.
"""
assert await async_setup_component(hass, "group", {})
test_group = await group.Group.async_create_group(
... | [
"async",
"def",
"test_group_being_init_before_first_tracked_state_is_set_to_on",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"}",
")",
"test_group",
"=",
"await",
"group",
".",
"Group",
".",
"async_crea... | [
271,
0
] | [
289,
40
] | python | en | ['en', 'en', 'en'] | True |
test_group_being_init_before_first_tracked_state_is_set_to_off | (hass) | Test if the group turns off.
If no states existed and now a state it is tracking is being added
as OFF.
| Test if the group turns off. | async def test_group_being_init_before_first_tracked_state_is_set_to_off(hass):
"""Test if the group turns off.
If no states existed and now a state it is tracking is being added
as OFF.
"""
assert await async_setup_component(hass, "group", {})
test_group = await group.Group.async_create_group(... | [
"async",
"def",
"test_group_being_init_before_first_tracked_state_is_set_to_off",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"}",
")",
"test_group",
"=",
"await",
"group",
".",
"Group",
".",
"async_cre... | [
292,
0
] | [
308,
41
] | python | en | ['en', 'en', 'en'] | True |
test_groups_get_unique_names | (hass) | Two groups with same name should both have a unique entity id. | Two groups with same name should both have a unique entity id. | async def test_groups_get_unique_names(hass):
"""Two groups with same name should both have a unique entity id."""
assert await async_setup_component(hass, "group", {})
grp1 = await group.Group.async_create_group(hass, "Je suis Charlie")
grp2 = await group.Group.async_create_group(hass, "Je suis Charl... | [
"async",
"def",
"test_groups_get_unique_names",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"}",
")",
"grp1",
"=",
"await",
"group",
".",
"Group",
".",
"async_create_group",
"(",
"hass",
",",
"\... | [
311,
0
] | [
319,
43
] | python | en | ['en', 'en', 'en'] | True |
test_expand_entity_ids_expands_nested_groups | (hass) | Test if entity ids epands to nested groups. | Test if entity ids epands to nested groups. | async def test_expand_entity_ids_expands_nested_groups(hass):
"""Test if entity ids epands to nested groups."""
assert await async_setup_component(hass, "group", {})
await group.Group.async_create_group(
hass, "light", ["light.test_1", "light.test_2"]
)
await group.Group.async_create_group... | [
"async",
"def",
"test_expand_entity_ids_expands_nested_groups",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"}",
")",
"await",
"group",
".",
"Group",
".",
"async_create_group",
"(",
"hass",
",",
"\"... | [
322,
0
] | [
342,
73
] | python | en | ['en', 'en', 'en'] | True |
test_set_assumed_state_based_on_tracked | (hass) | Test assumed state. | Test assumed state. | async def test_set_assumed_state_based_on_tracked(hass):
"""Test assumed state."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert await async_setup_component(hass, "group", {})
test_group = await group.Group.async_create_group(
hass, ... | [
"async",
"def",
"test_set_assumed_state_based_on_tracked",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"ass... | [
345,
0
] | [
369,
55
] | python | da | ['sv', 'da', 'en'] | False |
test_group_updated_after_device_tracker_zone_change | (hass) | Test group state when device tracker in group changes zone. | Test group state when device tracker in group changes zone. | async def test_group_updated_after_device_tracker_zone_change(hass):
"""Test group state when device tracker in group changes zone."""
hass.states.async_set("device_tracker.Adam", STATE_HOME)
hass.states.async_set("device_tracker.Eve", STATE_NOT_HOME)
await hass.async_block_till_done()
assert await... | [
"async",
"def",
"test_group_updated_after_device_tracker_zone_change",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"device_tracker.Adam\"",
",",
"STATE_HOME",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"device_tracker.Eve\"",
",",
... | [
372,
0
] | [
387,
75
] | python | en | ['en', 'en', 'en'] | True |
test_is_on | (hass) | Test is_on method. | Test is_on method. | async def test_is_on(hass):
"""Test is_on method."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
assert group.is_on(hass, "group.none") is False
assert await async_setup_component(hass, "light", {})
assert await async_setup_component(hass, "gr... | [
"async",
"def",
"test_is_on",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"assert",
"group",
".",
"is... | [
390,
0
] | [
411,
48
] | python | en | ['en', 'et', 'en'] | True |
test_reloading_groups | (hass) | Test reloading the group config. | Test reloading the group config. | async def test_reloading_groups(hass):
"""Test reloading the group config."""
assert await async_setup_component(
hass,
"group",
{
"group": {
"second_group": {"entities": "light.Bowl", "icon": "mdi:work"},
"test_group": "hello.world,sensor.happ... | [
"async",
"def",
"test_reloading_groups",
"(",
"hass",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"\"group\"",
":",
"{",
"\"second_group\"",
":",
"{",
"\"entities\"",
":",
"\"light.Bowl\"",
",",
"\"icon\"",
":",... | [
414,
0
] | [
463,
72
] | python | en | ['en', 'en', 'en'] | True |
test_modify_group | (hass) | Test modifying a group. | Test modifying a group. | async def test_modify_group(hass):
"""Test modifying a group."""
group_conf = OrderedDict()
group_conf["modify_group"] = {
"name": "friendly_name",
"icon": "mdi:work",
"entities": None,
}
assert await async_setup_component(hass, "group", {"group": group_conf})
await hass... | [
"async",
"def",
"test_modify_group",
"(",
"hass",
")",
":",
"group_conf",
"=",
"OrderedDict",
"(",
")",
"group_conf",
"[",
"\"modify_group\"",
"]",
"=",
"{",
"\"name\"",
":",
"\"friendly_name\"",
",",
"\"icon\"",
":",
"\"mdi:work\"",
",",
"\"entities\"",
":",
... | [
466,
0
] | [
489,
76
] | python | en | ['en', 'en', 'en'] | True |
test_setup | (hass) | Test setup method. | Test setup method. | async def test_setup(hass):
"""Test setup method."""
hass.states.async_set("light.Bowl", STATE_ON)
hass.states.async_set("light.Ceiling", STATE_OFF)
group_conf = OrderedDict()
group_conf["test_group"] = "hello.world,sensor.happy"
group_conf["empty_group"] = {"name": "Empty Group", "entities": N... | [
"async",
"def",
"test_setup",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Bowl\"",
",",
"STATE_ON",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.Ceiling\"",
",",
"STATE_OFF",
")",
"group_conf",
"=",
"OrderedDi... | [
492,
0
] | [
532,
60
] | python | en | ['en', 'et', 'en'] | True |
test_service_group_services | (hass) | Check if service are available. | Check if service are available. | async def test_service_group_services(hass):
"""Check if service are available."""
with assert_setup_component(0, "group"):
await async_setup_component(hass, "group", {"group": {}})
assert hass.services.has_service("group", group.SERVICE_SET)
assert hass.services.has_service("group", group.SERV... | [
"async",
"def",
"test_service_group_services",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"group\"",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"\"group\"",
":",
"{",
"}",
"}",
")",
"as... | [
535,
0
] | [
541,
67
] | python | en | ['en', 'en', 'en'] | True |
test_service_group_set_group_remove_group | (hass) | Check if service are available. | Check if service are available. | async def test_service_group_set_group_remove_group(hass):
"""Check if service are available."""
with assert_setup_component(0, "group"):
await async_setup_component(hass, "group", {"group": {}})
common.async_set_group(hass, "user_test_group", name="Test")
await hass.async_block_till_done()
... | [
"async",
"def",
"test_service_group_set_group_remove_group",
"(",
"hass",
")",
":",
"with",
"assert_setup_component",
"(",
"0",
",",
"\"group\"",
")",
":",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"group\"",
",",
"{",
"\"group\"",
":",
"{",
"}",
"}"... | [
545,
0
] | [
589,
30
] | python | en | ['en', 'en', 'en'] | True |
test_group_order | (hass) | Test that order gets incremented when creating a new group. | Test that order gets incremented when creating a new group. | async def test_group_order(hass):
"""Test that order gets incremented when creating a new group."""
hass.states.async_set("light.bowl", STATE_ON)
assert await async_setup_component(hass, "light", {})
assert await async_setup_component(
hass,
"group",
{
"group": {
... | [
"async",
"def",
"test_group_order",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.bowl\"",
",",
"STATE_ON",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"light\"",
",",
"{",
"}",
")",
"assert",
"await",... | [
592,
0
] | [
612,
70
] | python | en | ['en', 'en', 'en'] | True |
test_group_order_with_dynamic_creation | (hass) | Test that order gets incremented when creating a new group. | Test that order gets incremented when creating a new group. | async def test_group_order_with_dynamic_creation(hass):
"""Test that order gets incremented when creating a new group."""
hass.states.async_set("light.bowl", STATE_ON)
assert await async_setup_component(hass, "light", {})
assert await async_setup_component(
hass,
"group",
{
... | [
"async",
"def",
"test_group_order_with_dynamic_creation",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.bowl\"",
",",
"STATE_ON",
")",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"light\"",
",",
"{",
"}",
")",
... | [
615,
0
] | [
664,
71
] | python | en | ['en', 'en', 'en'] | True |
test_group_persons | (hass) | Test group of persons. | Test group of persons. | async def test_group_persons(hass):
"""Test group of persons."""
hass.states.async_set("person.one", "Work")
hass.states.async_set("person.two", "Work")
hass.states.async_set("person.three", "home")
assert await async_setup_component(hass, "person", {})
assert await async_setup_component(
... | [
"async",
"def",
"test_group_persons",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"person.one\"",
",",
"\"Work\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"person.two\"",
",",
"\"Work\"",
")",
"hass",
".",
"states",
... | [
667,
0
] | [
685,
62
] | python | en | ['en', 'en', 'en'] | True |
test_group_persons_and_device_trackers | (hass) | Test group of persons and device_tracker. | Test group of persons and device_tracker. | async def test_group_persons_and_device_trackers(hass):
"""Test group of persons and device_tracker."""
hass.states.async_set("person.one", "Work")
hass.states.async_set("person.two", "Work")
hass.states.async_set("person.three", "Work")
hass.states.async_set("device_tracker.one", "home")
asser... | [
"async",
"def",
"test_group_persons_and_device_trackers",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"person.one\"",
",",
"\"Work\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"person.two\"",
",",
"\"Work\"",
")",
"hass",
... | [
688,
0
] | [
710,
62
] | python | en | ['en', 'en', 'en'] | True |
test_group_mixed_domains_on | (hass) | Test group of mixed domains that is on. | Test group of mixed domains that is on. | async def test_group_mixed_domains_on(hass):
"""Test group of mixed domains that is on."""
hass.states.async_set("lock.alexander_garage_exit_door", "locked")
hass.states.async_set("binary_sensor.alexander_garage_side_door_open", "on")
hass.states.async_set("cover.small_garage_door", "open")
for dom... | [
"async",
"def",
"test_group_mixed_domains_on",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"lock.alexander_garage_exit_door\"",
",",
"\"locked\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"binary_sensor.alexander_garage_side_door_o... | [
713,
0
] | [
735,
60
] | python | en | ['en', 'en', 'en'] | True |
test_group_mixed_domains_off | (hass) | Test group of mixed domains that is off. | Test group of mixed domains that is off. | async def test_group_mixed_domains_off(hass):
"""Test group of mixed domains that is off."""
hass.states.async_set("lock.alexander_garage_exit_door", "unlocked")
hass.states.async_set("binary_sensor.alexander_garage_side_door_open", "off")
hass.states.async_set("cover.small_garage_door", "closed")
... | [
"async",
"def",
"test_group_mixed_domains_off",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"lock.alexander_garage_exit_door\"",
",",
"\"unlocked\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"binary_sensor.alexander_garage_side_doo... | [
738,
0
] | [
760,
61
] | python | en | ['en', 'en', 'en'] | True |
test_group_locks | (hass) | Test group of locks. | Test group of locks. | async def test_group_locks(hass):
"""Test group of locks."""
hass.states.async_set("lock.one", "locked")
hass.states.async_set("lock.two", "locked")
hass.states.async_set("lock.three", "unlocked")
assert await async_setup_component(hass, "lock", {})
assert await async_setup_component(
h... | [
"async",
"def",
"test_group_locks",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"lock.one\"",
",",
"\"locked\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"lock.two\"",
",",
"\"locked\"",
")",
"hass",
".",
"states",
".... | [
763,
0
] | [
781,
64
] | python | en | ['en', 'et', 'en'] | True |
test_group_sensors | (hass) | Test group of sensors. | Test group of sensors. | async def test_group_sensors(hass):
"""Test group of sensors."""
hass.states.async_set("sensor.one", "locked")
hass.states.async_set("sensor.two", "on")
hass.states.async_set("sensor.three", "closed")
assert await async_setup_component(hass, "sensor", {})
assert await async_setup_component(
... | [
"async",
"def",
"test_group_sensors",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.one\"",
",",
"\"locked\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"sensor.two\"",
",",
"\"on\"",
")",
"hass",
".",
"states",
... | [
784,
0
] | [
802,
65
] | python | en | ['en', 'no', 'en'] | True |
test_group_climate_mixed | (hass) | Test group of climate with mixed states. | Test group of climate with mixed states. | async def test_group_climate_mixed(hass):
"""Test group of climate with mixed states."""
hass.states.async_set("climate.one", "off")
hass.states.async_set("climate.two", "cool")
hass.states.async_set("climate.three", "heat")
assert await async_setup_component(hass, "climate", {})
assert await a... | [
"async",
"def",
"test_group_climate_mixed",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"climate.one\"",
",",
"\"off\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"climate.two\"",
",",
"\"cool\"",
")",
"hass",
".",
"stat... | [
805,
0
] | [
823,
64
] | python | en | ['en', 'en', 'en'] | True |
test_group_climate_all_cool | (hass) | Test group of climate all set to cool. | Test group of climate all set to cool. | async def test_group_climate_all_cool(hass):
"""Test group of climate all set to cool."""
hass.states.async_set("climate.one", "cool")
hass.states.async_set("climate.two", "cool")
hass.states.async_set("climate.three", "cool")
assert await async_setup_component(hass, "climate", {})
assert await... | [
"async",
"def",
"test_group_climate_all_cool",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"climate.one\"",
",",
"\"cool\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"climate.two\"",
",",
"\"cool\"",
")",
"hass",
".",
"... | [
826,
0
] | [
844,
64
] | python | en | ['en', 'en', 'en'] | True |
test_group_climate_all_off | (hass) | Test group of climate all set to off. | Test group of climate all set to off. | async def test_group_climate_all_off(hass):
"""Test group of climate all set to off."""
hass.states.async_set("climate.one", "off")
hass.states.async_set("climate.two", "off")
hass.states.async_set("climate.three", "off")
assert await async_setup_component(hass, "climate", {})
assert await asyn... | [
"async",
"def",
"test_group_climate_all_off",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"climate.one\"",
",",
"\"off\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"climate.two\"",
",",
"\"off\"",
")",
"hass",
".",
"sta... | [
847,
0
] | [
865,
65
] | python | en | ['en', 'en', 'en'] | True |
test_group_alarm | (hass) | Test group of alarm control panels. | Test group of alarm control panels. | async def test_group_alarm(hass):
"""Test group of alarm control panels."""
hass.states.async_set("alarm_control_panel.one", "armed_away")
hass.states.async_set("alarm_control_panel.two", "armed_home")
hass.states.async_set("alarm_control_panel.three", "armed_away")
hass.state = CoreState.stopped
... | [
"async",
"def",
"test_group_alarm",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"alarm_control_panel.one\"",
",",
"\"armed_away\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"alarm_control_panel.two\"",
",",
"\"armed_home\"",
... | [
868,
0
] | [
890,
64
] | python | en | ['en', 'en', 'en'] | True |
test_group_alarm_disarmed | (hass) | Test group of alarm control panels disarmed. | Test group of alarm control panels disarmed. | async def test_group_alarm_disarmed(hass):
"""Test group of alarm control panels disarmed."""
hass.states.async_set("alarm_control_panel.one", "disarmed")
hass.states.async_set("alarm_control_panel.two", "disarmed")
hass.states.async_set("alarm_control_panel.three", "disarmed")
assert await async_s... | [
"async",
"def",
"test_group_alarm_disarmed",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"alarm_control_panel.one\"",
",",
"\"disarmed\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"alarm_control_panel.two\"",
",",
"\"disarmed\"... | [
893,
0
] | [
913,
65
] | python | en | ['en', 'en', 'en'] | True |
test_group_vacuum_off | (hass) | Test group of vacuums. | Test group of vacuums. | async def test_group_vacuum_off(hass):
"""Test group of vacuums."""
hass.states.async_set("vacuum.one", "docked")
hass.states.async_set("vacuum.two", "off")
hass.states.async_set("vacuum.three", "off")
hass.state = CoreState.stopped
assert await async_setup_component(
hass,
"gro... | [
"async",
"def",
"test_group_vacuum_off",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"vacuum.one\"",
",",
"\"docked\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"vacuum.two\"",
",",
"\"off\"",
")",
"hass",
".",
"states"... | [
916,
0
] | [
937,
65
] | python | en | ['en', 'en', 'en'] | True |
test_group_vacuum_on | (hass) | Test group of vacuums. | Test group of vacuums. | async def test_group_vacuum_on(hass):
"""Test group of vacuums."""
hass.states.async_set("vacuum.one", "cleaning")
hass.states.async_set("vacuum.two", "off")
hass.states.async_set("vacuum.three", "off")
assert await async_setup_component(hass, "vacuum", {})
assert await async_setup_component(
... | [
"async",
"def",
"test_group_vacuum_on",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"vacuum.one\"",
",",
"\"cleaning\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"vacuum.two\"",
",",
"\"off\"",
")",
"hass",
".",
"states... | [
940,
0
] | [
958,
64
] | python | en | ['en', 'en', 'en'] | True |
test_device_tracker_not_home | (hass) | Test group of device_tracker not_home. | Test group of device_tracker not_home. | async def test_device_tracker_not_home(hass):
"""Test group of device_tracker not_home."""
hass.states.async_set("device_tracker.one", "not_home")
hass.states.async_set("device_tracker.two", "not_home")
hass.states.async_set("device_tracker.three", "not_home")
assert await async_setup_component(
... | [
"async",
"def",
"test_device_tracker_not_home",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"device_tracker.one\"",
",",
"\"not_home\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"device_tracker.two\"",
",",
"\"not_home\"",
")... | [
961,
0
] | [
980,
66
] | python | en | ['en', 'en', 'en'] | True |
test_light_removed | (hass) | Test group of lights when one is removed. | Test group of lights when one is removed. | async def test_light_removed(hass):
"""Test group of lights when one is removed."""
hass.states.async_set("light.one", "off")
hass.states.async_set("light.two", "off")
hass.states.async_set("light.three", "on")
assert await async_setup_component(
hass,
"group",
{
... | [
"async",
"def",
"test_light_removed",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.one\"",
",",
"\"off\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"light.two\"",
",",
"\"off\"",
")",
"hass",
".",
"states",
".",... | [
983,
0
] | [
1005,
61
] | python | en | ['en', 'en', 'en'] | True |
test_switch_removed | (hass) | Test group of switches when one is removed. | Test group of switches when one is removed. | async def test_switch_removed(hass):
"""Test group of switches when one is removed."""
hass.states.async_set("switch.one", "off")
hass.states.async_set("switch.two", "off")
hass.states.async_set("switch.three", "on")
hass.state = CoreState.stopped
assert await async_setup_component(
has... | [
"async",
"def",
"test_switch_removed",
"(",
"hass",
")",
":",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"switch.one\"",
",",
"\"off\"",
")",
"hass",
".",
"states",
".",
"async_set",
"(",
"\"switch.two\"",
",",
"\"off\"",
")",
"hass",
".",
"states",
"... | [
1008,
0
] | [
1037,
61
] | python | en | ['en', 'en', 'en'] | True |
test_lights_added_after_group | (hass) | Test lights added after group. | Test lights added after group. | async def test_lights_added_after_group(hass):
"""Test lights added after group."""
entity_ids = [
"light.living_front_ri",
"light.living_back_lef",
"light.living_back_cen",
"light.living_front_le",
"light.living_front_ce",
"light.living_back_rig",
]
ass... | [
"async",
"def",
"test_lights_added_after_group",
"(",
"hass",
")",
":",
"entity_ids",
"=",
"[",
"\"light.living_front_ri\"",
",",
"\"light.living_back_lef\"",
",",
"\"light.living_back_cen\"",
",",
"\"light.living_front_le\"",
",",
"\"light.living_front_ce\"",
",",
"\"light.l... | [
1040,
0
] | [
1069,
73
] | python | en | ['en', 'da', 'en'] | True |
test_lights_added_before_group | (hass) | Test lights added before group. | Test lights added before group. | async def test_lights_added_before_group(hass):
"""Test lights added before group."""
entity_ids = [
"light.living_front_ri",
"light.living_back_lef",
"light.living_back_cen",
"light.living_front_le",
"light.living_front_ce",
"light.living_back_rig",
]
f... | [
"async",
"def",
"test_lights_added_before_group",
"(",
"hass",
")",
":",
"entity_ids",
"=",
"[",
"\"light.living_front_ri\"",
",",
"\"light.living_back_lef\"",
",",
"\"light.living_back_cen\"",
",",
"\"light.living_front_le\"",
",",
"\"light.living_front_ce\"",
",",
"\"light.... | [
1072,
0
] | [
1099,
73
] | python | en | ['en', 'en', 'en'] | True |
test_cover_added_after_group | (hass) | Test cover added after group. | Test cover added after group. | async def test_cover_added_after_group(hass):
"""Test cover added after group."""
entity_ids = [
"cover.upstairs",
"cover.downstairs",
]
assert await async_setup_component(hass, "cover", {})
assert await async_setup_component(
hass,
"group",
{
"g... | [
"async",
"def",
"test_cover_added_after_group",
"(",
"hass",
")",
":",
"entity_ids",
"=",
"[",
"\"cover.upstairs\"",
",",
"\"cover.downstairs\"",
",",
"]",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"cover\"",
",",
"{",
"}",
")",
"assert",
"... | [
1102,
0
] | [
1133,
60
] | python | en | ['en', 'en', 'en'] | True |
test_group_that_references_a_group_of_lights | (hass) | Group that references a group of lights. | Group that references a group of lights. | async def test_group_that_references_a_group_of_lights(hass):
"""Group that references a group of lights."""
entity_ids = [
"light.living_front_ri",
"light.living_back_lef",
]
hass.state = CoreState.stopped
for entity_id in entity_ids:
hass.states.async_set(entity_id, "off"... | [
"async",
"def",
"test_group_that_references_a_group_of_lights",
"(",
"hass",
")",
":",
"entity_ids",
"=",
"[",
"\"light.living_front_ri\"",
",",
"\"light.living_back_lef\"",
",",
"]",
"hass",
".",
"state",
"=",
"CoreState",
".",
"stopped",
"for",
"entity_id",
"in",
... | [
1136,
0
] | [
1167,
64
] | python | en | ['en', 'en', 'en'] | True |
test_group_that_references_a_group_of_covers | (hass) | Group that references a group of covers. | Group that references a group of covers. | async def test_group_that_references_a_group_of_covers(hass):
"""Group that references a group of covers."""
entity_ids = [
"cover.living_front_ri",
"cover.living_back_lef",
]
hass.state = CoreState.stopped
for entity_id in entity_ids:
hass.states.async_set(entity_id, "clos... | [
"async",
"def",
"test_group_that_references_a_group_of_covers",
"(",
"hass",
")",
":",
"entity_ids",
"=",
"[",
"\"cover.living_front_ri\"",
",",
"\"cover.living_back_lef\"",
",",
"]",
"hass",
".",
"state",
"=",
"CoreState",
".",
"stopped",
"for",
"entity_id",
"in",
... | [
1170,
0
] | [
1203,
67
] | python | en | ['en', 'en', 'en'] | True |
test_group_that_references_two_groups_of_covers | (hass) | Group that references a group of covers. | Group that references a group of covers. | async def test_group_that_references_two_groups_of_covers(hass):
"""Group that references a group of covers."""
entity_ids = [
"cover.living_front_ri",
"cover.living_back_lef",
]
hass.state = CoreState.stopped
for entity_id in entity_ids:
hass.states.async_set(entity_id, "c... | [
"async",
"def",
"test_group_that_references_two_groups_of_covers",
"(",
"hass",
")",
":",
"entity_ids",
"=",
"[",
"\"cover.living_front_ri\"",
",",
"\"cover.living_back_lef\"",
",",
"]",
"hass",
".",
"state",
"=",
"CoreState",
".",
"stopped",
"for",
"entity_id",
"in",... | [
1206,
0
] | [
1243,
67
] | python | en | ['en', 'en', 'en'] | True |
test_group_that_references_two_types_of_groups | (hass) | Group that references a group of covers and device_trackers. | Group that references a group of covers and device_trackers. | async def test_group_that_references_two_types_of_groups(hass):
"""Group that references a group of covers and device_trackers."""
group_1_entity_ids = [
"cover.living_front_ri",
"cover.living_back_lef",
]
group_2_entity_ids = [
"device_tracker.living_front_ri",
"device_... | [
"async",
"def",
"test_group_that_references_two_types_of_groups",
"(",
"hass",
")",
":",
"group_1_entity_ids",
"=",
"[",
"\"cover.living_front_ri\"",
",",
"\"cover.living_back_lef\"",
",",
"]",
"group_2_entity_ids",
"=",
"[",
"\"device_tracker.living_front_ri\"",
",",
"\"devi... | [
1246,
0
] | [
1287,
63
] | python | en | ['en', 'en', 'en'] | True |
test_plant_group | (hass) | Test plant states can be grouped. | Test plant states can be grouped. | async def test_plant_group(hass):
"""Test plant states can be grouped."""
entity_ids = [
"plant.upstairs",
"plant.downstairs",
]
assert await async_setup_component(
hass,
"plant",
{
"plant": {
"plantname": {
"senso... | [
"async",
"def",
"test_plant_group",
"(",
"hass",
")",
":",
"entity_ids",
"=",
"[",
"\"plant.upstairs\"",
",",
"\"plant.downstairs\"",
",",
"]",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"plant\"",
",",
"{",
"\"plant\"",
":",
"{",
"\"plantna... | [
1290,
0
] | [
1350,
75
] | python | en | ['en', 'en', 'en'] | True |
async_attach_trigger | (hass, config, action, automation_info) | Listen for state changes based on configuration. | Listen for state changes based on configuration. | async def async_attach_trigger(hass, config, action, automation_info):
"""Listen for state changes based on configuration."""
numeric_state_config = {
numeric_state_trigger.CONF_PLATFORM: "numeric_state",
numeric_state_trigger.CONF_ENTITY_ID: config[CONF_ENTITY_ID],
}
if CONF_ABOVE in co... | [
"async",
"def",
"async_attach_trigger",
"(",
"hass",
",",
"config",
",",
"action",
",",
"automation_info",
")",
":",
"numeric_state_config",
"=",
"{",
"numeric_state_trigger",
".",
"CONF_PLATFORM",
":",
"\"numeric_state\"",
",",
"numeric_state_trigger",
".",
"CONF_ENT... | [
101,
0
] | [
117,
5
] | python | en | ['en', 'en', 'en'] | True |
async_get_triggers | (hass, device_id) | List device triggers. | List device triggers. | async def async_get_triggers(hass, device_id):
"""List device triggers."""
triggers = []
entity_registry = await hass.helpers.entity_registry.async_get_registry()
entries = [
entry
for entry in async_entries_for_device(entity_registry, device_id)
if entry.domain == DOMAIN
]
... | [
"async",
"def",
"async_get_triggers",
"(",
"hass",
",",
"device_id",
")",
":",
"triggers",
"=",
"[",
"]",
"entity_registry",
"=",
"await",
"hass",
".",
"helpers",
".",
"entity_registry",
".",
"async_get_registry",
"(",
")",
"entries",
"=",
"[",
"entry",
"for... | [
120,
0
] | [
159,
19
] | python | en | ['fr', 'en', 'en'] | True |
async_get_trigger_capabilities | (hass, config) | List trigger capabilities. | List trigger capabilities. | async def async_get_trigger_capabilities(hass, config):
"""List trigger capabilities."""
state = hass.states.get(config[CONF_ENTITY_ID])
unit_of_measurement = (
state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) if state else None
)
if not state or not unit_of_measurement:
raise Invalid... | [
"async",
"def",
"async_get_trigger_capabilities",
"(",
"hass",
",",
"config",
")",
":",
"state",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"config",
"[",
"CONF_ENTITY_ID",
"]",
")",
"unit_of_measurement",
"=",
"(",
"state",
".",
"attributes",
".",
"get",
... | [
162,
0
] | [
184,
5
] | python | en | ['en', 'la', 'en'] | True |
test_default_config | (hass, rfxtrx) | Test with 0 sensor. | Test with 0 sensor. | async def test_default_config(hass, rfxtrx):
"""Test with 0 sensor."""
entry_data = create_rfx_test_cfg(devices={})
mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data)
mock_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_entry.entry_id)
await has... | [
"async",
"def",
"test_default_config",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"}",
")",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"rfxtrx\"",
",",
"unique_id",
"=",
"DOMAIN",
... | [
17,
0
] | [
27,
44
] | python | en | ['en', 'en', 'en'] | True |
test_one_sensor | (hass, rfxtrx) | Test with 1 sensor. | Test with 1 sensor. | async def test_one_sensor(hass, rfxtrx):
"""Test with 1 sensor."""
entry_data = create_rfx_test_cfg(devices={"0a52080705020095220269": {}})
mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data)
mock_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_entry... | [
"async",
"def",
"test_one_sensor",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"0a52080705020095220269\"",
":",
"{",
"}",
"}",
")",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"rfx... | [
30,
0
] | [
47,
73
] | python | en | ['en', 'en', 'en'] | True |
test_state_restore | (hass, rfxtrx, state, event) | State restoration. | State restoration. | async def test_state_restore(hass, rfxtrx, state, event):
"""State restoration."""
entity_id = "sensor.wt260_wt260h_wt440h_wt450_wt450h_07_01_temperature"
mock_restore_cache(hass, [State(entity_id, state, attributes={ATTR_EVENT: event})])
entry_data = create_rfx_test_cfg(devices={"0a520801070100b81b0... | [
"async",
"def",
"test_state_restore",
"(",
"hass",
",",
"rfxtrx",
",",
"state",
",",
"event",
")",
":",
"entity_id",
"=",
"\"sensor.wt260_wt260h_wt440h_wt450_wt450h_07_01_temperature\"",
"mock_restore_cache",
"(",
"hass",
",",
"[",
"State",
"(",
"entity_id",
",",
"s... | [
54,
0
] | [
69,
52
] | python | en | ['en', 'hr', 'en'] | False |
test_one_sensor_no_datatype | (hass, rfxtrx) | Test with 1 sensor. | Test with 1 sensor. | async def test_one_sensor_no_datatype(hass, rfxtrx):
"""Test with 1 sensor."""
entry_data = create_rfx_test_cfg(devices={"0a52080705020095220269": {}})
mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data)
mock_entry.add_to_hass(hass)
await hass.config_entries.async_setu... | [
"async",
"def",
"test_one_sensor_no_datatype",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"0a52080705020095220269\"",
":",
"{",
"}",
"}",
")",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"... | [
72,
0
] | [
116,
71
] | python | en | ['en', 'en', 'en'] | True |
test_several_sensors | (hass, rfxtrx) | Test with 3 sensors. | Test with 3 sensors. | async def test_several_sensors(hass, rfxtrx):
"""Test with 3 sensors."""
entry_data = create_rfx_test_cfg(
devices={
"0a52080705020095220269": {},
"0a520802060100ff0e0269": {},
}
)
mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data)
... | [
"async",
"def",
"test_several_sensors",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"0a52080705020095220269\"",
":",
"{",
"}",
",",
"\"0a520802060100ff0e0269\"",
":",
"{",
"}",
",",
"}",
")",
"moc... | [
119,
0
] | [
160,
71
] | python | en | ['en', 'en', 'en'] | True |
test_discover_sensor | (hass, rfxtrx_automatic) | Test with discovery of sensor. | Test with discovery of sensor. | async def test_discover_sensor(hass, rfxtrx_automatic):
"""Test with discovery of sensor."""
rfxtrx = rfxtrx_automatic
# 1
await rfxtrx.signal("0a520801070100b81b0279")
base_id = "sensor.wt260_wt260h_wt440h_wt450_wt450h_07_01"
state = hass.states.get(f"{base_id}_humidity")
assert state
... | [
"async",
"def",
"test_discover_sensor",
"(",
"hass",
",",
"rfxtrx_automatic",
")",
":",
"rfxtrx",
"=",
"rfxtrx_automatic",
"# 1",
"await",
"rfxtrx",
".",
"signal",
"(",
"\"0a520801070100b81b0279\"",
")",
"base_id",
"=",
"\"sensor.wt260_wt260h_wt440h_wt450_wt450h_07_01\"",... | [
163,
0
] | [
263,
45
] | python | en | ['en', 'en', 'en'] | True |
test_update_of_sensors | (hass, rfxtrx) | Test with 3 sensors. | Test with 3 sensors. | async def test_update_of_sensors(hass, rfxtrx):
"""Test with 3 sensors."""
entry_data = create_rfx_test_cfg(
devices={
"0a52080705020095220269": {},
"0a520802060100ff0e0269": {},
}
)
mock_entry = MockConfigEntry(domain="rfxtrx", unique_id=DOMAIN, data=entry_data)
... | [
"async",
"def",
"test_update_of_sensors",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"0a52080705020095220269\"",
":",
"{",
"}",
",",
"\"0a520802060100ff0e0269\"",
":",
"{",
"}",
",",
"}",
")",
"m... | [
266,
0
] | [
307,
30
] | python | en | ['en', 'en', 'en'] | True |
test_rssi_sensor | (hass, rfxtrx) | Test with 1 sensor. | Test with 1 sensor. | async def test_rssi_sensor(hass, rfxtrx):
"""Test with 1 sensor."""
entry_data = create_rfx_test_cfg(
devices={
"0913000022670e013b70": {
"data_bits": 4,
"command_on": 0xE,
"command_off": 0x7,
},
"0b1100cd0213c7f230010f7... | [
"async",
"def",
"test_rssi_sensor",
"(",
"hass",
",",
"rfxtrx",
")",
":",
"entry_data",
"=",
"create_rfx_test_cfg",
"(",
"devices",
"=",
"{",
"\"0913000022670e013b70\"",
":",
"{",
"\"data_bits\"",
":",
"4",
",",
"\"command_on\"",
":",
"0xE",
",",
"\"command_off\... | [
310,
0
] | [
368,
31
] | python | en | ['en', 'en', 'en'] | True |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Wink binary sensor platform. | Set up the Wink binary sensor platform. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Wink binary sensor platform."""
for sensor in pywink.get_sensors():
_id = sensor.object_id() + sensor.name()
if _id not in hass.data[DOMAIN]["unique_ids"]:
if sensor.capability() in SENSOR_TYPES:
... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"for",
"sensor",
"in",
"pywink",
".",
"get_sensors",
"(",
")",
":",
"_id",
"=",
"sensor",
".",
"object_id",
"(",
")",
"+",
"sensor",
... | [
37,
0
] | [
88,
63
] | python | en | ['en', 'da', 'en'] | True |
WinkBinarySensorEntity.__init__ | (self, wink, hass) | Initialize the Wink binary sensor. | Initialize the Wink binary sensor. | def __init__(self, wink, hass):
"""Initialize the Wink binary sensor."""
super().__init__(wink, hass)
if hasattr(self.wink, "unit"):
self._unit_of_measurement = self.wink.unit()
else:
self._unit_of_measurement = None
if hasattr(self.wink, "capability"):
... | [
"def",
"__init__",
"(",
"self",
",",
"wink",
",",
"hass",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"wink",
",",
"hass",
")",
"if",
"hasattr",
"(",
"self",
".",
"wink",
",",
"\"unit\"",
")",
":",
"self",
".",
"_unit_of_measurement",
"=",
"... | [
94,
4
] | [
104,
34
] | python | en | ['en', 'fy', 'en'] | True |
WinkBinarySensorEntity.async_added_to_hass | (self) | Call when entity is added to hass. | Call when entity is added to hass. | async def async_added_to_hass(self):
"""Call when entity is added to hass."""
self.hass.data[DOMAIN]["entities"]["binary_sensor"].append(self) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"\"entities\"",
"]",
"[",
"\"binary_sensor\"",
"]",
".",
"append",
"(",
"self",
")"
] | [
106,
4
] | [
108,
72
] | python | en | ['en', 'en', 'en'] | True |
WinkBinarySensorEntity.is_on | (self) | Return true if the binary sensor is on. | Return true if the binary sensor is on. | def is_on(self):
"""Return true if the binary sensor is on."""
return self.wink.state() | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"state",
"(",
")"
] | [
111,
4
] | [
113,
32
] | python | en | ['en', 'fy', 'en'] | True |
WinkBinarySensorEntity.device_class | (self) | Return the class of this sensor, from DEVICE_CLASSES. | Return the class of this sensor, from DEVICE_CLASSES. | def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES."""
return SENSOR_TYPES.get(self.capability) | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"SENSOR_TYPES",
".",
"get",
"(",
"self",
".",
"capability",
")"
] | [
116,
4
] | [
118,
48
] | python | en | ['en', 'en', 'en'] | True |
WinkBinarySensorEntity.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
return super().device_state_attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"super",
"(",
")",
".",
"device_state_attributes"
] | [
121,
4
] | [
123,
46
] | python | en | ['en', 'en', 'en'] | True |
WinkSmokeDetector.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
_attributes = super().device_state_attributes
_attributes["test_activated"] = self.wink.test_activated()
return _attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"_attributes",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"_attributes",
"[",
"\"test_activated\"",
"]",
"=",
"self",
".",
"wink",
".",
"test_activated",
"(",
")",
"return",
"_attributes"
] | [
130,
4
] | [
134,
26
] | python | en | ['en', 'en', 'en'] | True |
WinkHub.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
_attributes = super().device_state_attributes
_attributes["update_needed"] = self.wink.update_needed()
_attributes["firmware_version"] = self.wink.firmware_version()
_attributes["pairing_mode"] = self.wi... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"_attributes",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"_attributes",
"[",
"\"update_needed\"",
"]",
"=",
"self",
".",
"wink",
".",
"update_needed",
"(",
")",
"_attributes",
"[",
"\"firmwar... | [
141,
4
] | [
154,
26
] | python | en | ['en', 'en', 'en'] | True |
WinkRemote.device_state_attributes | (self) | Return the state attributes. | Return the state attributes. | def device_state_attributes(self):
"""Return the state attributes."""
_attributes = super().device_state_attributes
_attributes["button_on_pressed"] = self.wink.button_on_pressed()
_attributes["button_off_pressed"] = self.wink.button_off_pressed()
_attributes["button_up_pressed"]... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"_attributes",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"_attributes",
"[",
"\"button_on_pressed\"",
"]",
"=",
"self",
".",
"wink",
".",
"button_on_pressed",
"(",
")",
"_attributes",
"[",
"\... | [
161,
4
] | [
168,
26
] | python | en | ['en', 'en', 'en'] | True |
WinkRemote.device_class | (self) | Return the class of this sensor, from DEVICE_CLASSES. | Return the class of this sensor, from DEVICE_CLASSES. | def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES."""
return None | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"None"
] | [
171,
4
] | [
173,
19
] | python | en | ['en', 'en', 'en'] | True |
WinkButton.device_state_attributes | (self) | Return the device state attributes. | Return the device state attributes. | def device_state_attributes(self):
"""Return the device state attributes."""
_attributes = super().device_state_attributes
_attributes["pressed"] = self.wink.pressed()
_attributes["long_pressed"] = self.wink.long_pressed()
return _attributes | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"_attributes",
"=",
"super",
"(",
")",
".",
"device_state_attributes",
"_attributes",
"[",
"\"pressed\"",
"]",
"=",
"self",
".",
"wink",
".",
"pressed",
"(",
")",
"_attributes",
"[",
"\"long_pressed\"",
... | [
180,
4
] | [
185,
26
] | python | en | ['en', 'en', 'en'] | True |
WinkGang.is_on | (self) | Return true if the gang is connected. | Return true if the gang is connected. | def is_on(self):
"""Return true if the gang is connected."""
return self.wink.state() | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"wink",
".",
"state",
"(",
")"
] | [
192,
4
] | [
194,
32
] | python | en | ['en', 'en', 'en'] | True |
mock_http_client | (hass, aiohttp_client) | Start the Home Assistant HTTP component. | Start the Home Assistant HTTP component. | def mock_http_client(hass, aiohttp_client):
"""Start the Home Assistant HTTP component."""
hass.loop.run_until_complete(async_setup_component(hass, "frontend", {}))
return hass.loop.run_until_complete(aiohttp_client(hass.http.app)) | [
"def",
"mock_http_client",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"async_setup_component",
"(",
"hass",
",",
"\"frontend\"",
",",
"{",
"}",
")",
")",
"return",
"hass",
".",
"loop",
".",
"run_until_c... | [
35,
0
] | [
38,
70
] | python | en | ['en', 'en', 'en'] | True |
mock_http_client_with_themes | (hass, aiohttp_client) | Start the Home Assistant HTTP component. | Start the Home Assistant HTTP component. | def mock_http_client_with_themes(hass, aiohttp_client):
"""Start the Home Assistant HTTP component."""
hass.loop.run_until_complete(
async_setup_component(
hass,
"frontend",
{DOMAIN: {CONF_THEMES: {"happy": {"primary-color": "red"}}}},
)
)
return hass.... | [
"def",
"mock_http_client_with_themes",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"async_setup_component",
"(",
"hass",
",",
"\"frontend\"",
",",
"{",
"DOMAIN",
":",
"{",
"CONF_THEMES",
":",
"{",
"\"happy\"... | [
42,
0
] | [
51,
70
] | python | en | ['en', 'en', 'en'] | True |
mock_http_client_with_urls | (hass, aiohttp_client) | Start the Home Assistant HTTP component. | Start the Home Assistant HTTP component. | def mock_http_client_with_urls(hass, aiohttp_client):
"""Start the Home Assistant HTTP component."""
hass.loop.run_until_complete(
async_setup_component(
hass,
"frontend",
{
DOMAIN: {
CONF_JS_VERSION: "auto",
CON... | [
"def",
"mock_http_client_with_urls",
"(",
"hass",
",",
"aiohttp_client",
")",
":",
"hass",
".",
"loop",
".",
"run_until_complete",
"(",
"async_setup_component",
"(",
"hass",
",",
"\"frontend\"",
",",
"{",
"DOMAIN",
":",
"{",
"CONF_JS_VERSION",
":",
"\"auto\"",
"... | [
55,
0
] | [
72,
70
] | python | en | ['en', 'en', 'en'] | True |
mock_onboarded | () | Mock that we're onboarded. | Mock that we're onboarded. | def mock_onboarded():
"""Mock that we're onboarded."""
with patch(
"homeassistant.components.onboarding.async_is_onboarded", return_value=True
):
yield | [
"def",
"mock_onboarded",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onboarding.async_is_onboarded\"",
",",
"return_value",
"=",
"True",
")",
":",
"yield"
] | [
76,
0
] | [
81,
13
] | python | en | ['en', 'en', 'en'] | True |
test_frontend_and_static | (mock_http_client, mock_onboarded) | Test if we can get the frontend. | Test if we can get the frontend. | async def test_frontend_and_static(mock_http_client, mock_onboarded):
"""Test if we can get the frontend."""
resp = await mock_http_client.get("")
assert resp.status == 200
assert "cache-control" not in resp.headers
text = await resp.text()
# Test we can retrieve frontend.js
frontendjs = r... | [
"async",
"def",
"test_frontend_and_static",
"(",
"mock_http_client",
",",
"mock_onboarded",
")",
":",
"resp",
"=",
"await",
"mock_http_client",
".",
"get",
"(",
"\"\"",
")",
"assert",
"resp",
".",
"status",
"==",
"200",
"assert",
"\"cache-control\"",
"not",
"in"... | [
84,
0
] | [
98,
56
] | python | en | ['en', 'en', 'en'] | True |
test_dont_cache_service_worker | (mock_http_client) | Test that we don't cache the service worker. | Test that we don't cache the service worker. | async def test_dont_cache_service_worker(mock_http_client):
"""Test that we don't cache the service worker."""
resp = await mock_http_client.get("/service_worker.js")
assert resp.status == 200
assert "cache-control" not in resp.headers | [
"async",
"def",
"test_dont_cache_service_worker",
"(",
"mock_http_client",
")",
":",
"resp",
"=",
"await",
"mock_http_client",
".",
"get",
"(",
"\"/service_worker.js\"",
")",
"assert",
"resp",
".",
"status",
"==",
"200",
"assert",
"\"cache-control\"",
"not",
"in",
... | [
101,
0
] | [
105,
46
] | python | en | ['en', 'en', 'en'] | True |
test_404 | (mock_http_client) | Test for HTTP 404 error. | Test for HTTP 404 error. | async def test_404(mock_http_client):
"""Test for HTTP 404 error."""
resp = await mock_http_client.get("/not-existing")
assert resp.status == HTTP_NOT_FOUND | [
"async",
"def",
"test_404",
"(",
"mock_http_client",
")",
":",
"resp",
"=",
"await",
"mock_http_client",
".",
"get",
"(",
"\"/not-existing\"",
")",
"assert",
"resp",
".",
"status",
"==",
"HTTP_NOT_FOUND"
] | [
108,
0
] | [
111,
40
] | python | da | ['da', 'no', 'en'] | False |
test_we_cannot_POST_to_root | (mock_http_client) | Test that POST is not allow to root. | Test that POST is not allow to root. | async def test_we_cannot_POST_to_root(mock_http_client):
"""Test that POST is not allow to root."""
resp = await mock_http_client.post("/")
assert resp.status == 405 | [
"async",
"def",
"test_we_cannot_POST_to_root",
"(",
"mock_http_client",
")",
":",
"resp",
"=",
"await",
"mock_http_client",
".",
"post",
"(",
"\"/\"",
")",
"assert",
"resp",
".",
"status",
"==",
"405"
] | [
114,
0
] | [
117,
29
] | python | en | ['en', 'en', 'en'] | True |
test_themes_api | (hass, hass_ws_client) | Test that /api/themes returns correct data. | Test that /api/themes returns correct data. | async def test_themes_api(hass, hass_ws_client):
"""Test that /api/themes returns correct data."""
assert await async_setup_component(hass, "frontend", CONFIG_THEMES)
client = await hass_ws_client(hass)
await client.send_json({"id": 5, "type": "frontend/get_themes"})
msg = await client.receive_json... | [
"async",
"def",
"test_themes_api",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"frontend\"",
",",
"CONFIG_THEMES",
")",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"client... | [
120,
0
] | [
143,
5
] | python | en | ['en', 'bg-Latn', 'en'] | True |
test_themes_persist | (hass, hass_ws_client, hass_storage) | Test that theme settings are restores after restart. | Test that theme settings are restores after restart. | async def test_themes_persist(hass, hass_ws_client, hass_storage):
"""Test that theme settings are restores after restart."""
hass_storage[THEMES_STORAGE_KEY] = {
"key": THEMES_STORAGE_KEY,
"version": 1,
"data": {
"frontend_default_theme": "happy",
"frontend_defa... | [
"async",
"def",
"test_themes_persist",
"(",
"hass",
",",
"hass_ws_client",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"THEMES_STORAGE_KEY",
"]",
"=",
"{",
"\"key\"",
":",
"THEMES_STORAGE_KEY",
",",
"\"version\"",
":",
"1",
",",
"\"data\"",
":",
"{",
"... | [
146,
0
] | [
165,
56
] | python | en | ['en', 'en', 'en'] | True |
test_themes_save_storage | (hass, hass_storage) | Test that theme settings are restores after restart. | Test that theme settings are restores after restart. | async def test_themes_save_storage(hass, hass_storage):
"""Test that theme settings are restores after restart."""
hass_storage[THEMES_STORAGE_KEY] = {
"key": THEMES_STORAGE_KEY,
"version": 1,
"data": {},
}
assert await async_setup_component(hass, "frontend", CONFIG_THEMES)
... | [
"async",
"def",
"test_themes_save_storage",
"(",
"hass",
",",
"hass_storage",
")",
":",
"hass_storage",
"[",
"THEMES_STORAGE_KEY",
"]",
"=",
"{",
"\"key\"",
":",
"THEMES_STORAGE_KEY",
",",
"\"version\"",
":",
"1",
",",
"\"data\"",
":",
"{",
"}",
",",
"}",
"a... | [
168,
0
] | [
195,
5
] | python | en | ['en', 'en', 'en'] | True |
test_themes_set_theme | (hass, hass_ws_client) | Test frontend.set_theme service. | Test frontend.set_theme service. | async def test_themes_set_theme(hass, hass_ws_client):
"""Test frontend.set_theme service."""
assert await async_setup_component(hass, "frontend", CONFIG_THEMES)
client = await hass_ws_client(hass)
await hass.services.async_call(
DOMAIN, "set_theme", {"name": "happy"}, blocking=True
)
... | [
"async",
"def",
"test_themes_set_theme",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"frontend\"",
",",
"CONFIG_THEMES",
")",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await",
"... | [
198,
0
] | [
230,
54
] | python | en | ['en', 'en', 'en'] | True |
test_themes_set_theme_wrong_name | (hass, hass_ws_client) | Test frontend.set_theme service called with wrong name. | Test frontend.set_theme service called with wrong name. | async def test_themes_set_theme_wrong_name(hass, hass_ws_client):
"""Test frontend.set_theme service called with wrong name."""
assert await async_setup_component(hass, "frontend", CONFIG_THEMES)
client = await hass_ws_client(hass)
await hass.services.async_call(
DOMAIN, "set_theme", {"name": "... | [
"async",
"def",
"test_themes_set_theme_wrong_name",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"frontend\"",
",",
"CONFIG_THEMES",
")",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"... | [
233,
0
] | [
246,
54
] | python | en | ['en', 'en', 'en'] | True |
test_themes_set_dark_theme | (hass, hass_ws_client) | Test frontend.set_theme service called with dark mode. | Test frontend.set_theme service called with dark mode. | async def test_themes_set_dark_theme(hass, hass_ws_client):
"""Test frontend.set_theme service called with dark mode."""
assert await async_setup_component(hass, "frontend", CONFIG_THEMES)
client = await hass_ws_client(hass)
await hass.services.async_call(
DOMAIN, "set_theme", {"name": "dark", ... | [
"async",
"def",
"test_themes_set_dark_theme",
"(",
"hass",
",",
"hass_ws_client",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"frontend\"",
",",
"CONFIG_THEMES",
")",
"client",
"=",
"await",
"hass_ws_client",
"(",
"hass",
")",
"await"... | [
249,
0
] | [
279,
54
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.