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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Runner._kubectl | (self, stdin, *args) |
|return| (return_code, stdout, stderr)
|
|return| (return_code, stdout, stderr)
| def _kubectl(self, stdin, *args):
"""
|return| (return_code, stdout, stderr)
"""
cmdline = [self.args.kubectl_exec] + list(args)
_log.debug('kubectl %s', cmdline)
proc = subprocess.Popen(cmdline, stdin=PIPE, stdout=PIPE, stderr=PIPE)
if isinstance(stdin, str):
stdin = stdin.encode()
... | [
"def",
"_kubectl",
"(",
"self",
",",
"stdin",
",",
"*",
"args",
")",
":",
"cmdline",
"=",
"[",
"self",
".",
"args",
".",
"kubectl_exec",
"]",
"+",
"list",
"(",
"args",
")",
"_log",
".",
"debug",
"(",
"'kubectl %s'",
",",
"cmdline",
")",
"proc",
"="... | [
158,
2
] | [
174,
50
] | python | en | ['en', 'error', 'th'] | False |
async_setup | (hass, config) | Set up the Plex component. | Set up the Plex component. | async def async_setup(hass, config):
"""Set up the Plex component."""
hass.data.setdefault(
PLEX_DOMAIN,
{SERVERS: {}, DISPATCHERS: {}, WEBSOCKETS: {}, PLATFORMS_COMPLETED: {}},
)
await async_setup_services(hass)
gdm = hass.data[PLEX_DOMAIN][GDM_SCANNER] = GDM()
def gdm_scan()... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"PLEX_DOMAIN",
",",
"{",
"SERVERS",
":",
"{",
"}",
",",
"DISPATCHERS",
":",
"{",
"}",
",",
"WEBSOCKETS",
":",
"{",
"}",
",",
"PLATFORMS_... | [
50,
0
] | [
73,
15
] | python | en | ['en', 'fr', 'en'] | True |
async_setup_entry | (hass, entry) | Set up Plex from a config entry. | Set up Plex from a config entry. | async def async_setup_entry(hass, entry):
"""Set up Plex from a config entry."""
server_config = entry.data[PLEX_SERVER_CONFIG]
if entry.unique_id is None:
hass.config_entries.async_update_entry(
entry, unique_id=entry.data[CONF_SERVER_IDENTIFIER]
)
if MP_DOMAIN not in entr... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
")",
":",
"server_config",
"=",
"entry",
".",
"data",
"[",
"PLEX_SERVER_CONFIG",
"]",
"if",
"entry",
".",
"unique_id",
"is",
"None",
":",
"hass",
".",
"config_entries",
".",
"async_update_entry",
... | [
76,
0
] | [
219,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, entry) | Unload a config entry. | Unload a config entry. | async def async_unload_entry(hass, entry):
"""Unload a config entry."""
server_id = entry.data[CONF_SERVER_IDENTIFIER]
websocket = hass.data[PLEX_DOMAIN][WEBSOCKETS].pop(server_id)
websocket.close()
dispatchers = hass.data[PLEX_DOMAIN][DISPATCHERS].pop(server_id)
for unsub in dispatchers:
... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"entry",
")",
":",
"server_id",
"=",
"entry",
".",
"data",
"[",
"CONF_SERVER_IDENTIFIER",
"]",
"websocket",
"=",
"hass",
".",
"data",
"[",
"PLEX_DOMAIN",
"]",
"[",
"WEBSOCKETS",
"]",
".",
"pop",
"(",
... | [
222,
0
] | [
237,
20
] | python | en | ['en', 'es', 'en'] | True |
async_options_updated | (hass, entry) | Triggered by config entry options updates. | Triggered by config entry options updates. | async def async_options_updated(hass, entry):
"""Triggered by config entry options updates."""
server_id = entry.data[CONF_SERVER_IDENTIFIER]
# Guard incomplete setup during reauth flows
if server_id in hass.data[PLEX_DOMAIN][SERVERS]:
hass.data[PLEX_DOMAIN][SERVERS][server_id].options = entry.... | [
"async",
"def",
"async_options_updated",
"(",
"hass",
",",
"entry",
")",
":",
"server_id",
"=",
"entry",
".",
"data",
"[",
"CONF_SERVER_IDENTIFIER",
"]",
"# Guard incomplete setup during reauth flows",
"if",
"server_id",
"in",
"hass",
".",
"data",
"[",
"PLEX_DOMAIN"... | [
240,
0
] | [
246,
74
] | python | en | ['en', 'en', 'en'] | True |
async_cleanup_plex_devices | (hass, entry) | Clean up old and invalid devices from the registry. | Clean up old and invalid devices from the registry. | def async_cleanup_plex_devices(hass, entry):
"""Clean up old and invalid devices from the registry."""
device_registry = dev_reg.async_get(hass)
entity_registry = ent_reg.async_get(hass)
device_entries = hass.helpers.device_registry.async_entries_for_config_entry(
device_registry, entry.entry_i... | [
"def",
"async_cleanup_plex_devices",
"(",
"hass",
",",
"entry",
")",
":",
"device_registry",
"=",
"dev_reg",
".",
"async_get",
"(",
"hass",
")",
"entity_registry",
"=",
"ent_reg",
".",
"async_get",
"(",
"hass",
")",
"device_entries",
"=",
"hass",
".",
"helpers... | [
250,
0
] | [
273,
64
] | python | en | ['en', 'en', 'en'] | True |
Network.__init__ | (self, hass: HomeAssistant) | Initialize the Network class. | Initialize the Network class. | def __init__(self, hass: HomeAssistant) -> None:
"""Initialize the Network class."""
self._store = hass.helpers.storage.Store(STORAGE_VERSION, STORAGE_KEY)
self._data: dict[str, Any] = {}
self.adapters: list[Adapter] = [] | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistant",
")",
"->",
"None",
":",
"self",
".",
"_store",
"=",
"hass",
".",
"helpers",
".",
"storage",
".",
"Store",
"(",
"STORAGE_VERSION",
",",
"STORAGE_KEY",
")",
"self",
".",
"_data",
":",
"di... | [
25,
4
] | [
29,
41
] | python | en | ['en', 'en', 'en'] | True |
Network.configured_adapters | (self) | Return the configured adapters. | Return the configured adapters. | def configured_adapters(self) -> list[str]:
"""Return the configured adapters."""
return self._data.get(ATTR_CONFIGURED_ADAPTERS, DEFAULT_CONFIGURED_ADAPTERS) | [
"def",
"configured_adapters",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_data",
".",
"get",
"(",
"ATTR_CONFIGURED_ADAPTERS",
",",
"DEFAULT_CONFIGURED_ADAPTERS",
")"
] | [
32,
4
] | [
34,
84
] | python | en | ['en', 'en', 'en'] | True |
Network.async_setup | (self) | Set up the network config. | Set up the network config. | async def async_setup(self) -> None:
"""Set up the network config."""
await self.async_load()
self.adapters = await async_load_adapters() | [
"async",
"def",
"async_setup",
"(",
"self",
")",
"->",
"None",
":",
"await",
"self",
".",
"async_load",
"(",
")",
"self",
".",
"adapters",
"=",
"await",
"async_load_adapters",
"(",
")"
] | [
36,
4
] | [
39,
51
] | python | en | ['en', 'en', 'en'] | True |
Network.async_migrate_from_zeroconf | (self, zc_config: dict[str, Any]) | Migrate configuration from zeroconf. | Migrate configuration from zeroconf. | async def async_migrate_from_zeroconf(self, zc_config: dict[str, Any]) -> None:
"""Migrate configuration from zeroconf."""
if self._data or not zc_config:
return
from homeassistant.components.zeroconf import ( # pylint: disable=import-outside-toplevel
CONF_DEFAULT_INTER... | [
"async",
"def",
"async_migrate_from_zeroconf",
"(",
"self",
",",
"zc_config",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"if",
"self",
".",
"_data",
"or",
"not",
"zc_config",
":",
"return",
"from",
"homeassistant",
".",
"components",... | [
41,
4
] | [
54,
36
] | python | en | ['en', 'en', 'en'] | True |
Network.async_configure | (self) | Configure from storage. | Configure from storage. | def async_configure(self) -> None:
"""Configure from storage."""
if not enable_adapters(self.adapters, self.configured_adapters):
enable_auto_detected_adapters(self.adapters) | [
"def",
"async_configure",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"enable_adapters",
"(",
"self",
".",
"adapters",
",",
"self",
".",
"configured_adapters",
")",
":",
"enable_auto_detected_adapters",
"(",
"self",
".",
"adapters",
")"
] | [
57,
4
] | [
60,
56
] | python | en | ['en', 'en', 'en'] | True |
Network.async_reconfig | (self, config: dict[str, Any]) | Reconfigure network. | Reconfigure network. | async def async_reconfig(self, config: dict[str, Any]) -> None:
"""Reconfigure network."""
self._data[ATTR_CONFIGURED_ADAPTERS] = config[ATTR_CONFIGURED_ADAPTERS]
self.async_configure()
await self._async_save() | [
"async",
"def",
"async_reconfig",
"(",
"self",
",",
"config",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"None",
":",
"self",
".",
"_data",
"[",
"ATTR_CONFIGURED_ADAPTERS",
"]",
"=",
"config",
"[",
"ATTR_CONFIGURED_ADAPTERS",
"]",
"self",
".",
... | [
62,
4
] | [
66,
32
] | python | en | ['en', 'nl', 'en'] | False |
Network.async_load | (self) | Load config. | Load config. | async def async_load(self) -> None:
"""Load config."""
if stored := await self._store.async_load():
self._data = cast(dict, stored) | [
"async",
"def",
"async_load",
"(",
"self",
")",
"->",
"None",
":",
"if",
"stored",
":=",
"await",
"self",
".",
"_store",
".",
"async_load",
"(",
")",
":",
"self",
".",
"_data",
"=",
"cast",
"(",
"dict",
",",
"stored",
")"
] | [
68,
4
] | [
71,
43
] | python | en | ['en', 'es', 'en'] | False |
Network._async_save | (self) | Save preferences. | Save preferences. | async def _async_save(self) -> None:
"""Save preferences."""
await self._store.async_save(self._data) | [
"async",
"def",
"_async_save",
"(",
"self",
")",
"->",
"None",
":",
"await",
"self",
".",
"_store",
".",
"async_save",
"(",
"self",
".",
"_data",
")"
] | [
73,
4
] | [
75,
48
] | python | en | ['en', 'ceb', 'en'] | False |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the device tracker platform. | Set up the device tracker platform. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the device tracker platform."""
client = hass.data[DOMAIN][config_entry.entry_id][DATA_CLIENT]
coordinator = hass.data[DOMAIN][config_entry.entry_id][DATA_COORDINATOR]
entities = []
for index, _ in enumerate(coordinator... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"client",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"config_entry",
".",
"entry_id",
"]",
"[",
"DATA_CLIENT",
"]",
"coordinator",
"=",
"hass"... | [
8,
0
] | [
18,
32
] | python | en | ['en', 'cs', 'en'] | True |
MazdaDeviceTracker.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
vehicle_name = self.get_vehicle_name()
return f"{vehicle_name} Device Tracker" | [
"def",
"name",
"(",
"self",
")",
":",
"vehicle_name",
"=",
"self",
".",
"get_vehicle_name",
"(",
")",
"return",
"f\"{vehicle_name} Device Tracker\""
] | [
25,
4
] | [
28,
47
] | python | en | ['en', 'en', 'en'] | True |
MazdaDeviceTracker.unique_id | (self) | Return a unique identifier for this entity. | Return a unique identifier for this entity. | def unique_id(self):
"""Return a unique identifier for this entity."""
return self.vin | [
"def",
"unique_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"vin"
] | [
31,
4
] | [
33,
23
] | python | en | ['en', 'fr', 'en'] | True |
MazdaDeviceTracker.icon | (self) | Return the icon to use in the frontend. | Return the icon to use in the frontend. | def icon(self):
"""Return the icon to use in the frontend."""
return "mdi:car" | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"\"mdi:car\""
] | [
36,
4
] | [
38,
24
] | python | en | ['en', 'en', 'en'] | True |
MazdaDeviceTracker.source_type | (self) | Return the source type, eg gps or router, of the device. | Return the source type, eg gps or router, of the device. | def source_type(self):
"""Return the source type, eg gps or router, of the device."""
return SOURCE_TYPE_GPS | [
"def",
"source_type",
"(",
"self",
")",
":",
"return",
"SOURCE_TYPE_GPS"
] | [
41,
4
] | [
43,
30
] | python | en | ['en', 'en', 'en'] | True |
MazdaDeviceTracker.force_update | (self) | All updates do not need to be written to the state machine. | All updates do not need to be written to the state machine. | def force_update(self):
"""All updates do not need to be written to the state machine."""
return False | [
"def",
"force_update",
"(",
"self",
")",
":",
"return",
"False"
] | [
46,
4
] | [
48,
20
] | python | en | ['en', 'en', 'en'] | True |
MazdaDeviceTracker.latitude | (self) | Return latitude value of the device. | Return latitude value of the device. | def latitude(self):
"""Return latitude value of the device."""
return self.data["status"]["latitude"] | [
"def",
"latitude",
"(",
"self",
")",
":",
"return",
"self",
".",
"data",
"[",
"\"status\"",
"]",
"[",
"\"latitude\"",
"]"
] | [
51,
4
] | [
53,
46
] | python | en | ['en', 'en', 'en'] | True |
MazdaDeviceTracker.longitude | (self) | Return longitude value of the device. | Return longitude value of the device. | def longitude(self):
"""Return longitude value of the device."""
return self.data["status"]["longitude"] | [
"def",
"longitude",
"(",
"self",
")",
":",
"return",
"self",
".",
"data",
"[",
"\"status\"",
"]",
"[",
"\"longitude\"",
"]"
] | [
56,
4
] | [
58,
47
] | python | en | ['en', 'zu', '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 |
FarrayTestCase.testConstructor1 | (self) | Test Farray size constructor | Test Farray size constructor | def testConstructor1(self):
"Test Farray size constructor"
self.failUnless(isinstance(self.array, Farray.Farray)) | [
"def",
"testConstructor1",
"(",
"self",
")",
":",
"self",
".",
"failUnless",
"(",
"isinstance",
"(",
"self",
".",
"array",
",",
"Farray",
".",
"Farray",
")",
")"
] | [
30,
4
] | [
32,
62
] | python | en | ['en', 'en', 'en'] | True |
FarrayTestCase.testConstructor2 | (self) | Test Farray copy constructor | Test Farray copy constructor | def testConstructor2(self):
"Test Farray copy constructor"
for i in range(self.nrows):
for j in range(self.ncols):
self.array[i, j] = i + j
arrayCopy = Farray.Farray(self.array)
self.failUnless(arrayCopy == self.array) | [
"def",
"testConstructor2",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"nrows",
")",
":",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"ncols",
")",
":",
"self",
".",
"array",
"[",
"i",
",",
"j",
"]",
"=",
"i",
"+",
"j... | [
34,
4
] | [
40,
48
] | python | en | ['en', 'gl', 'en'] | True |
FarrayTestCase.testConstructorBad1 | (self) | Test Farray size constructor, negative nrows | Test Farray size constructor, negative nrows | def testConstructorBad1(self):
"Test Farray size constructor, negative nrows"
self.assertRaises(ValueError, Farray.Farray, -4, 4) | [
"def",
"testConstructorBad1",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"ValueError",
",",
"Farray",
".",
"Farray",
",",
"-",
"4",
",",
"4",
")"
] | [
42,
4
] | [
44,
59
] | python | en | ['sl', 'en', 'en'] | True |
FarrayTestCase.testConstructorBad2 | (self) | Test Farray size constructor, negative ncols | Test Farray size constructor, negative ncols | def testConstructorBad2(self):
"Test Farray size constructor, negative ncols"
self.assertRaises(ValueError, Farray.Farray, 4, -4) | [
"def",
"testConstructorBad2",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"ValueError",
",",
"Farray",
".",
"Farray",
",",
"4",
",",
"-",
"4",
")"
] | [
46,
4
] | [
48,
59
] | python | en | ['sl', 'en', 'en'] | True |
FarrayTestCase.testNrows | (self) | Test Farray nrows method | Test Farray nrows method | def testNrows(self):
"Test Farray nrows method"
self.failUnless(self.array.nrows() == self.nrows) | [
"def",
"testNrows",
"(",
"self",
")",
":",
"self",
".",
"failUnless",
"(",
"self",
".",
"array",
".",
"nrows",
"(",
")",
"==",
"self",
".",
"nrows",
")"
] | [
50,
4
] | [
52,
57
] | python | en | ['en', 'hmn', 'en'] | True |
FarrayTestCase.testNcols | (self) | Test Farray ncols method | Test Farray ncols method | def testNcols(self):
"Test Farray ncols method"
self.failUnless(self.array.ncols() == self.ncols) | [
"def",
"testNcols",
"(",
"self",
")",
":",
"self",
".",
"failUnless",
"(",
"self",
".",
"array",
".",
"ncols",
"(",
")",
"==",
"self",
".",
"ncols",
")"
] | [
54,
4
] | [
56,
57
] | python | en | ['en', 'hmn', 'en'] | True |
FarrayTestCase.testLen | (self) | Test Farray __len__ method | Test Farray __len__ method | def testLen(self):
"Test Farray __len__ method"
self.failUnless(len(self.array) == self.nrows*self.ncols) | [
"def",
"testLen",
"(",
"self",
")",
":",
"self",
".",
"failUnless",
"(",
"len",
"(",
"self",
".",
"array",
")",
"==",
"self",
".",
"nrows",
"*",
"self",
".",
"ncols",
")"
] | [
58,
4
] | [
60,
65
] | python | en | ['en', 'no', 'tr'] | False |
FarrayTestCase.testSetGet | (self) | Test Farray __setitem__, __getitem__ methods | Test Farray __setitem__, __getitem__ methods | def testSetGet(self):
"Test Farray __setitem__, __getitem__ methods"
m = self.nrows
n = self.ncols
for i in range(m):
for j in range(n):
self.array[i, j] = i*j
for i in range(m):
for j in range(n):
self.failUnless(self.array... | [
"def",
"testSetGet",
"(",
"self",
")",
":",
"m",
"=",
"self",
".",
"nrows",
"n",
"=",
"self",
".",
"ncols",
"for",
"i",
"in",
"range",
"(",
"m",
")",
":",
"for",
"j",
"in",
"range",
"(",
"n",
")",
":",
"self",
".",
"array",
"[",
"i",
",",
"... | [
62,
4
] | [
71,
56
] | python | en | ['en', 'et', 'hi'] | False |
FarrayTestCase.testSetBad1 | (self) | Test Farray __setitem__ method, negative row | Test Farray __setitem__ method, negative row | def testSetBad1(self):
"Test Farray __setitem__ method, negative row"
self.assertRaises(IndexError, self.array.__setitem__, (-1, 3), 0) | [
"def",
"testSetBad1",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"IndexError",
",",
"self",
".",
"array",
".",
"__setitem__",
",",
"(",
"-",
"1",
",",
"3",
")",
",",
"0",
")"
] | [
73,
4
] | [
75,
73
] | python | hi | ['sl', 'hu', 'hi'] | False |
FarrayTestCase.testSetBad2 | (self) | Test Farray __setitem__ method, negative col | Test Farray __setitem__ method, negative col | def testSetBad2(self):
"Test Farray __setitem__ method, negative col"
self.assertRaises(IndexError, self.array.__setitem__, (1, -3), 0) | [
"def",
"testSetBad2",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"IndexError",
",",
"self",
".",
"array",
".",
"__setitem__",
",",
"(",
"1",
",",
"-",
"3",
")",
",",
"0",
")"
] | [
77,
4
] | [
79,
73
] | python | da | ['sl', 'da', 'hi'] | False |
FarrayTestCase.testSetBad3 | (self) | Test Farray __setitem__ method, out-of-range row | Test Farray __setitem__ method, out-of-range row | def testSetBad3(self):
"Test Farray __setitem__ method, out-of-range row"
self.assertRaises(IndexError, self.array.__setitem__, (self.nrows+1, 0), 0) | [
"def",
"testSetBad3",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"IndexError",
",",
"self",
".",
"array",
".",
"__setitem__",
",",
"(",
"self",
".",
"nrows",
"+",
"1",
",",
"0",
")",
",",
"0",
")"
] | [
81,
4
] | [
83,
83
] | python | en | ['en', 'el-Latn', 'en'] | True |
FarrayTestCase.testSetBad4 | (self) | Test Farray __setitem__ method, out-of-range col | Test Farray __setitem__ method, out-of-range col | def testSetBad4(self):
"Test Farray __setitem__ method, out-of-range col"
self.assertRaises(IndexError, self.array.__setitem__, (0, self.ncols+1), 0) | [
"def",
"testSetBad4",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"IndexError",
",",
"self",
".",
"array",
".",
"__setitem__",
",",
"(",
"0",
",",
"self",
".",
"ncols",
"+",
"1",
")",
",",
"0",
")"
] | [
85,
4
] | [
87,
83
] | python | en | ['en', 'da', 'en'] | True |
FarrayTestCase.testGetBad1 | (self) | Test Farray __getitem__ method, negative row | Test Farray __getitem__ method, negative row | def testGetBad1(self):
"Test Farray __getitem__ method, negative row"
self.assertRaises(IndexError, self.array.__getitem__, (-1, 3)) | [
"def",
"testGetBad1",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"IndexError",
",",
"self",
".",
"array",
".",
"__getitem__",
",",
"(",
"-",
"1",
",",
"3",
")",
")"
] | [
89,
4
] | [
91,
70
] | python | hi | ['sl', 'pl', 'hi'] | False |
FarrayTestCase.testGetBad2 | (self) | Test Farray __getitem__ method, negative col | Test Farray __getitem__ method, negative col | def testGetBad2(self):
"Test Farray __getitem__ method, negative col"
self.assertRaises(IndexError, self.array.__getitem__, (1, -3)) | [
"def",
"testGetBad2",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"IndexError",
",",
"self",
".",
"array",
".",
"__getitem__",
",",
"(",
"1",
",",
"-",
"3",
")",
")"
] | [
93,
4
] | [
95,
70
] | python | da | ['sl', 'da', 'hi'] | False |
FarrayTestCase.testGetBad3 | (self) | Test Farray __getitem__ method, out-of-range row | Test Farray __getitem__ method, out-of-range row | def testGetBad3(self):
"Test Farray __getitem__ method, out-of-range row"
self.assertRaises(IndexError, self.array.__getitem__, (self.nrows+1, 0)) | [
"def",
"testGetBad3",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"IndexError",
",",
"self",
".",
"array",
".",
"__getitem__",
",",
"(",
"self",
".",
"nrows",
"+",
"1",
",",
"0",
")",
")"
] | [
97,
4
] | [
99,
80
] | python | en | ['en', 'en', 'en'] | True |
FarrayTestCase.testGetBad4 | (self) | Test Farray __getitem__ method, out-of-range col | Test Farray __getitem__ method, out-of-range col | def testGetBad4(self):
"Test Farray __getitem__ method, out-of-range col"
self.assertRaises(IndexError, self.array.__getitem__, (0, self.ncols+1)) | [
"def",
"testGetBad4",
"(",
"self",
")",
":",
"self",
".",
"assertRaises",
"(",
"IndexError",
",",
"self",
".",
"array",
".",
"__getitem__",
",",
"(",
"0",
",",
"self",
".",
"ncols",
"+",
"1",
")",
")"
] | [
101,
4
] | [
103,
80
] | python | en | ['en', 'da', 'en'] | True |
FarrayTestCase.testAsString | (self) | Test Farray asString method | Test Farray asString method | def testAsString(self):
"Test Farray asString method"
result = """\
[ [ 0, 1, 2, 3 ],
[ 1, 2, 3, 4 ],
[ 2, 3, 4, 5 ],
[ 3, 4, 5, 6 ],
[ 4, 5, 6, 7 ] ]
"""
for i in range(self.nrows):
for j in range(self.ncols):
self.array[i, j] = i+j
self.failUnless(se... | [
"def",
"testAsString",
"(",
"self",
")",
":",
"result",
"=",
"\"\"\"\\\n[ [ 0, 1, 2, 3 ],\n [ 1, 2, 3, 4 ],\n [ 2, 3, 4, 5 ],\n [ 3, 4, 5, 6 ],\n [ 4, 5, 6, 7 ] ]\n\"\"\"",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"nrows",
")",
":",
"for",
"j",
"in",
"range",
"(... | [
105,
4
] | [
117,
56
] | python | en | ['en', 'no', 'en'] | True |
FarrayTestCase.testStr | (self) | Test Farray __str__ method | Test Farray __str__ method | def testStr(self):
"Test Farray __str__ method"
result = """\
[ [ 0, -1, -2, -3 ],
[ 1, 0, -1, -2 ],
[ 2, 1, 0, -1 ],
[ 3, 2, 1, 0 ],
[ 4, 3, 2, 1 ] ]
"""
for i in range(self.nrows):
for j in range(self.ncols):
self.array[i, j] = i-j
self.failUnless(st... | [
"def",
"testStr",
"(",
"self",
")",
":",
"result",
"=",
"\"\"\"\\\n[ [ 0, -1, -2, -3 ],\n [ 1, 0, -1, -2 ],\n [ 2, 1, 0, -1 ],\n [ 3, 2, 1, 0 ],\n [ 4, 3, 2, 1 ] ]\n\"\"\"",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"nrows",
")",
":",
"for",
"j",
"in",
"range",
"... | [
119,
4
] | [
131,
50
] | python | en | ['en', 'no', 'en'] | True |
FarrayTestCase.testView | (self) | Test Farray view method | Test Farray view method | def testView(self):
"Test Farray view method"
for i in range(self.nrows):
for j in range(self.ncols):
self.array[i, j] = i+j
a = self.array.view()
self.failUnless(isinstance(a, np.ndarray))
self.failUnless(a.flags.f_contiguous)
for i in range(s... | [
"def",
"testView",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"nrows",
")",
":",
"for",
"j",
"in",
"range",
"(",
"self",
".",
"ncols",
")",
":",
"self",
".",
"array",
"[",
"i",
",",
"j",
"]",
"=",
"i",
"+",
"j",
"a"... | [
133,
4
] | [
143,
47
] | python | en | ['en', 'el-Latn', 'en'] | True |
test_wrong_train_setting | (tmpdir) |
* Test that an error is thrown when no `train_dataloader()` is defined
* Test that an error is thrown when no `training_step()` is defined
|
* Test that an error is thrown when no `train_dataloader()` is defined
* Test that an error is thrown when no `training_step()` is defined
| def test_wrong_train_setting(tmpdir):
"""
* Test that an error is thrown when no `train_dataloader()` is defined
* Test that an error is thrown when no `training_step()` is defined
"""
tutils.reset_seed()
hparams = EvalModelTemplate.get_default_hparams()
trainer = Trainer(default_root_dir=tm... | [
"def",
"test_wrong_train_setting",
"(",
"tmpdir",
")",
":",
"tutils",
".",
"reset_seed",
"(",
")",
"hparams",
"=",
"EvalModelTemplate",
".",
"get_default_hparams",
"(",
")",
"trainer",
"=",
"Trainer",
"(",
"default_root_dir",
"=",
"tmpdir",
",",
"max_epochs",
"=... | [
23,
0
] | [
40,
26
] | python | en | ['en', 'error', 'th'] | False |
test_wrong_configure_optimizers | (tmpdir) | Test that an error is thrown when no `configure_optimizers()` is defined | Test that an error is thrown when no `configure_optimizers()` is defined | def test_wrong_configure_optimizers(tmpdir):
""" Test that an error is thrown when no `configure_optimizers()` is defined """
tutils.reset_seed()
trainer = Trainer(default_root_dir=tmpdir, max_epochs=1)
with pytest.raises(MisconfigurationException):
model = EvalModelTemplate()
model.con... | [
"def",
"test_wrong_configure_optimizers",
"(",
"tmpdir",
")",
":",
"tutils",
".",
"reset_seed",
"(",
")",
"trainer",
"=",
"Trainer",
"(",
"default_root_dir",
"=",
"tmpdir",
",",
"max_epochs",
"=",
"1",
")",
"with",
"pytest",
".",
"raises",
"(",
"Misconfigurati... | [
43,
0
] | [
51,
26
] | python | en | ['en', 'en', 'en'] | True |
test_val_loop_config | (tmpdir) |
When either val loop or val data are missing raise warning
|
When either val loop or val data are missing raise warning
| def test_val_loop_config(tmpdir):
""""
When either val loop or val data are missing raise warning
"""
tutils.reset_seed()
hparams = EvalModelTemplate.get_default_hparams()
trainer = Trainer(default_root_dir=tmpdir, max_epochs=1)
# no val data has val loop
with pytest.warns(UserWarning):... | [
"def",
"test_val_loop_config",
"(",
"tmpdir",
")",
":",
"tutils",
".",
"reset_seed",
"(",
")",
"hparams",
"=",
"EvalModelTemplate",
".",
"get_default_hparams",
"(",
")",
"trainer",
"=",
"Trainer",
"(",
"default_root_dir",
"=",
"tmpdir",
",",
"max_epochs",
"=",
... | [
54,
0
] | [
72,
26
] | python | en | ['en', 'error', 'th'] | False |
test_test_loop_config | (tmpdir) |
When either test loop or test data are missing
|
When either test loop or test data are missing
| def test_test_loop_config(tmpdir):
""""
When either test loop or test data are missing
"""
hparams = EvalModelTemplate.get_default_hparams()
trainer = Trainer(default_root_dir=tmpdir, max_epochs=1)
# has test loop but no test data
with pytest.warns(UserWarning):
model = EvalModelTem... | [
"def",
"test_test_loop_config",
"(",
"tmpdir",
")",
":",
"hparams",
"=",
"EvalModelTemplate",
".",
"get_default_hparams",
"(",
")",
"trainer",
"=",
"Trainer",
"(",
"default_root_dir",
"=",
"tmpdir",
",",
"max_epochs",
"=",
"1",
")",
"# has test loop but no test data... | [
75,
0
] | [
92,
75
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.