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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
IGloLamp.is_on | (self) | Return true if light is on. | Return true if light is on. | def is_on(self):
"""Return true if light is on."""
return self._lamp.state()["on"] | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lamp",
".",
"state",
"(",
")",
"[",
"\"on\"",
"]"
] | [
101,
4
] | [
103,
39
] | python | en | ['en', 'et', 'en'] | True |
IGloLamp.turn_on | (self, **kwargs) | Turn the light on. | Turn the light on. | def turn_on(self, **kwargs):
"""Turn the light on."""
if not self.is_on:
self._lamp.switch(True)
if ATTR_BRIGHTNESS in kwargs:
brightness = int((kwargs[ATTR_BRIGHTNESS] / 255.0) * 200.0)
self._lamp.brightness(brightness)
return
if ATTR_HS_... | [
"def",
"turn_on",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"is_on",
":",
"self",
".",
"_lamp",
".",
"switch",
"(",
"True",
")",
"if",
"ATTR_BRIGHTNESS",
"in",
"kwargs",
":",
"brightness",
"=",
"int",
"(",
"(",
"kwar... | [
105,
4
] | [
129,
18
] | python | en | ['en', 'et', 'en'] | True |
IGloLamp.turn_off | (self, **kwargs) | Turn the light off. | Turn the light off. | def turn_off(self, **kwargs):
"""Turn the light off."""
self._lamp.switch(False) | [
"def",
"turn_off",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_lamp",
".",
"switch",
"(",
"False",
")"
] | [
131,
4
] | [
133,
32
] | python | en | ['en', 'zh', 'en'] | True |
Tag.__init__ | (self, id=None, name=None, local_vars_configuration=None) | Tag - a model defined in OpenAPI | Tag - a model defined in OpenAPI | def __init__(self, id=None, name=None, local_vars_configuration=None): # noqa: E501
"""Tag - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration.get_default_copy()
self.local_vars_configuration = local_vars_config... | [
"def",
"__init__",
"(",
"self",
",",
"id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"local_vars_configuration",
"=",
"None",
")",
":",
"# noqa: E501",
"# noqa: E501",
"if",
"local_vars_configuration",
"is",
"None",
":",
"local_vars_configuration",
"=",
"Confi... | [
44,
4
] | [
57,
28
] | python | en | ['en', 'en', 'en'] | True |
Tag.id | (self) | Gets the id of this Tag. # noqa: E501
:return: The id of this Tag. # noqa: E501
:rtype: int
| Gets the id of this Tag. # noqa: E501 | def id(self):
"""Gets the id of this Tag. # noqa: E501
:return: The id of this Tag. # noqa: E501
:rtype: int
"""
return self._id | [
"def",
"id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_id"
] | [
60,
4
] | [
67,
23
] | python | en | ['en', 'en', 'en'] | True |
Tag.id | (self, id) | Sets the id of this Tag.
:param id: The id of this Tag. # noqa: E501
:type id: int
| Sets the id of this Tag. | def id(self, id):
"""Sets the id of this Tag.
:param id: The id of this Tag. # noqa: E501
:type id: int
"""
self._id = id | [
"def",
"id",
"(",
"self",
",",
"id",
")",
":",
"self",
".",
"_id",
"=",
"id"
] | [
70,
4
] | [
78,
21
] | python | en | ['en', 'en', 'en'] | True |
Tag.name | (self) | Gets the name of this Tag. # noqa: E501
:return: The name of this Tag. # noqa: E501
:rtype: str
| Gets the name of this Tag. # noqa: E501 | def name(self):
"""Gets the name of this Tag. # noqa: E501
:return: The name of this Tag. # noqa: E501
:rtype: str
"""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
81,
4
] | [
88,
25
] | python | en | ['en', 'en', 'en'] | True |
Tag.name | (self, name) | Sets the name of this Tag.
:param name: The name of this Tag. # noqa: E501
:type name: str
| Sets the name of this Tag. | def name(self, name):
"""Sets the name of this Tag.
:param name: The name of this Tag. # noqa: E501
:type name: str
"""
self._name = name | [
"def",
"name",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_name",
"=",
"name"
] | [
91,
4
] | [
99,
25
] | python | en | ['en', 'en', 'en'] | True |
Tag.to_dict | (self, serialize=False) | Returns the model properties as a dict | Returns the model properties as a dict | def to_dict(self, serialize=False):
"""Returns the model properties as a dict"""
result = {}
def convert(x):
if hasattr(x, "to_dict"):
args = inspect.getargspec(x.to_dict).args
if len(args) == 1:
return x.to_dict()
... | [
"def",
"to_dict",
"(",
"self",
",",
"serialize",
"=",
"False",
")",
":",
"result",
"=",
"{",
"}",
"def",
"convert",
"(",
"x",
")",
":",
"if",
"hasattr",
"(",
"x",
",",
"\"to_dict\"",
")",
":",
"args",
"=",
"inspect",
".",
"getargspec",
"(",
"x",
... | [
101,
4
] | [
131,
21
] | python | en | ['en', 'en', 'en'] | True |
Tag.to_str | (self) | Returns the string representation of the model | Returns the string representation of the model | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | [
133,
4
] | [
135,
45
] | python | en | ['en', 'en', 'en'] | True |
Tag.__repr__ | (self) | For `print` and `pprint` | For `print` and `pprint` | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | [
137,
4
] | [
139,
28
] | python | en | ['en', 'en', 'en'] | True |
Tag.__eq__ | (self, other) | Returns true if both objects are equal | Returns true if both objects are equal | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, Tag):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Tag",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | [
141,
4
] | [
146,
48
] | python | en | ['en', 'en', 'en'] | True |
Tag.__ne__ | (self, other) | Returns true if both objects are not equal | Returns true if both objects are not equal | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, Tag):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Tag",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | [
148,
4
] | [
153,
48
] | python | en | ['en', 'en', 'en'] | True |
test_waste_drawer_sensor | (hass, mock_account) | Tests the waste drawer sensor entity was set up. | Tests the waste drawer sensor entity was set up. | async def test_waste_drawer_sensor(hass, mock_account):
"""Tests the waste drawer sensor entity was set up."""
await setup_integration(hass, mock_account, PLATFORM_DOMAIN)
sensor = hass.states.get(WASTE_DRAWER_ENTITY_ID)
assert sensor
assert sensor.state == "50.0"
assert sensor.attributes["unit... | [
"async",
"def",
"test_waste_drawer_sensor",
"(",
"hass",
",",
"mock_account",
")",
":",
"await",
"setup_integration",
"(",
"hass",
",",
"mock_account",
",",
"PLATFORM_DOMAIN",
")",
"sensor",
"=",
"hass",
".",
"states",
".",
"get",
"(",
"WASTE_DRAWER_ENTITY_ID",
... | [
12,
0
] | [
19,
65
] | python | en | ['en', 'da', 'en'] | True |
test_sleep_time_sensor_with_none_state | (hass) | Tests the sleep mode start time sensor where sleep mode is inactive. | Tests the sleep mode start time sensor where sleep mode is inactive. | async def test_sleep_time_sensor_with_none_state(hass):
"""Tests the sleep mode start time sensor where sleep mode is inactive."""
robot = create_mock_robot({"sleepModeActive": "0"})
sensor = LitterRobotSleepTimeSensor(
robot, "Sleep Mode Start Time", Mock(), "sleep_mode_start_time"
)
sensor... | [
"async",
"def",
"test_sleep_time_sensor_with_none_state",
"(",
"hass",
")",
":",
"robot",
"=",
"create_mock_robot",
"(",
"{",
"\"sleepModeActive\"",
":",
"\"0\"",
"}",
")",
"sensor",
"=",
"LitterRobotSleepTimeSensor",
"(",
"robot",
",",
"\"Sleep Mode Start Time\"",
",... | [
22,
0
] | [
32,
56
] | python | en | ['en', 'ceb', 'en'] | True |
test_gauge_icon | () | Test icon generator for gauge sensor. | Test icon generator for gauge sensor. | async def test_gauge_icon():
"""Test icon generator for gauge sensor."""
from homeassistant.components.litterrobot.sensor import icon_for_gauge_level
GAUGE_EMPTY = "mdi:gauge-empty"
GAUGE_LOW = "mdi:gauge-low"
GAUGE = "mdi:gauge"
GAUGE_FULL = "mdi:gauge-full"
assert icon_for_gauge_level(No... | [
"async",
"def",
"test_gauge_icon",
"(",
")",
":",
"from",
"homeassistant",
".",
"components",
".",
"litterrobot",
".",
"sensor",
"import",
"icon_for_gauge_level",
"GAUGE_EMPTY",
"=",
"\"mdi:gauge-empty\"",
"GAUGE_LOW",
"=",
"\"mdi:gauge-low\"",
"GAUGE",
"=",
"\"mdi:ga... | [
35,
0
] | [
56,
54
] | python | en | ['en', 'da', 'en'] | True |
init_config_flow | (hass) | Init a configuration flow. | Init a configuration flow. | def init_config_flow(hass):
"""Init a configuration flow."""
config_flow.register_flow_implementation(
hass,
DOMAIN,
client_id="id",
client_secret="secret",
api_key="123",
redirect_uri="http://example.com",
sensors=None,
)
flow = config_flow.LogiCi... | [
"def",
"init_config_flow",
"(",
"hass",
")",
":",
"config_flow",
".",
"register_flow_implementation",
"(",
"hass",
",",
"DOMAIN",
",",
"client_id",
"=",
"\"id\"",
",",
"client_secret",
"=",
"\"secret\"",
",",
"api_key",
"=",
"\"123\"",
",",
"redirect_uri",
"=",
... | [
27,
0
] | [
43,
15
] | python | en | ['es', 'fr', 'en'] | False |
mock_logi_circle | () | Mock logi_circle. | Mock logi_circle. | def mock_logi_circle():
"""Mock logi_circle."""
with patch(
"homeassistant.components.logi_circle.config_flow.LogiCircle"
) as logi_circle:
LogiCircle = logi_circle()
LogiCircle.authorize = AsyncMock(return_value=True)
LogiCircle.close = AsyncMock(return_value=True)
L... | [
"def",
"mock_logi_circle",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.logi_circle.config_flow.LogiCircle\"",
")",
"as",
"logi_circle",
":",
"LogiCircle",
"=",
"logi_circle",
"(",
")",
"LogiCircle",
".",
"authorize",
"=",
"AsyncMock",
"(",
"return... | [
47,
0
] | [
57,
24
] | python | en | ['en', 'yo', 'en'] | False |
test_step_import | (
hass, mock_logi_circle # pylint: disable=redefined-outer-name
) | Test that we trigger import when configuring with client. | Test that we trigger import when configuring with client. | async def test_step_import(
hass, mock_logi_circle # pylint: disable=redefined-outer-name
):
"""Test that we trigger import when configuring with client."""
flow = init_config_flow(hass)
result = await flow.async_step_import()
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert re... | [
"async",
"def",
"test_step_import",
"(",
"hass",
",",
"mock_logi_circle",
"# pylint: disable=redefined-outer-name",
")",
":",
"flow",
"=",
"init_config_flow",
"(",
"hass",
")",
"result",
"=",
"await",
"flow",
".",
"async_step_import",
"(",
")",
"assert",
"result",
... | [
60,
0
] | [
68,
38
] | python | en | ['en', 'en', 'en'] | True |
test_full_flow_implementation | (
hass, mock_logi_circle # pylint: disable=redefined-outer-name
) | Test registering an implementation and finishing flow works. | Test registering an implementation and finishing flow works. | async def test_full_flow_implementation(
hass, mock_logi_circle # pylint: disable=redefined-outer-name
):
"""Test registering an implementation and finishing flow works."""
config_flow.register_flow_implementation(
hass,
"test-other",
client_id=None,
client_secret=None,
... | [
"async",
"def",
"test_full_flow_implementation",
"(",
"hass",
",",
"mock_logi_circle",
"# pylint: disable=redefined-outer-name",
")",
":",
"config_flow",
".",
"register_flow_implementation",
"(",
"hass",
",",
"\"test-other\"",
",",
"client_id",
"=",
"None",
",",
"client_s... | [
71,
0
] | [
99,
65
] | python | en | ['en', 'en', 'en'] | True |
test_we_reprompt_user_to_follow_link | (hass) | Test we prompt user to follow link if previously prompted. | Test we prompt user to follow link if previously prompted. | async def test_we_reprompt_user_to_follow_link(hass):
"""Test we prompt user to follow link if previously prompted."""
flow = init_config_flow(hass)
result = await flow.async_step_auth("dummy")
assert result["errors"]["base"] == "follow_link" | [
"async",
"def",
"test_we_reprompt_user_to_follow_link",
"(",
"hass",
")",
":",
"flow",
"=",
"init_config_flow",
"(",
"hass",
")",
"result",
"=",
"await",
"flow",
".",
"async_step_auth",
"(",
"\"dummy\"",
")",
"assert",
"result",
"[",
"\"errors\"",
"]",
"[",
"\... | [
102,
0
] | [
107,
52
] | python | en | ['en', 'en', 'en'] | True |
test_abort_if_no_implementation_registered | (hass) | Test we abort if no implementation is registered. | Test we abort if no implementation is registered. | async def test_abort_if_no_implementation_registered(hass):
"""Test we abort if no implementation is registered."""
flow = config_flow.LogiCircleFlowHandler()
flow.hass = hass
result = await flow.async_step_user()
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"... | [
"async",
"def",
"test_abort_if_no_implementation_registered",
"(",
"hass",
")",
":",
"flow",
"=",
"config_flow",
".",
"LogiCircleFlowHandler",
"(",
")",
"flow",
".",
"hass",
"=",
"hass",
"result",
"=",
"await",
"flow",
".",
"async_step_user",
"(",
")",
"assert",... | [
110,
0
] | [
117,
54
] | python | en | ['en', 'en', 'en'] | True |
test_abort_if_already_setup | (hass) | Test we abort if Logi Circle is already setup. | Test we abort if Logi Circle is already setup. | async def test_abort_if_already_setup(hass):
"""Test we abort if Logi Circle is already setup."""
flow = init_config_flow(hass)
MockConfigEntry(domain=config_flow.DOMAIN).add_to_hass(hass)
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN,
context={"source": config_... | [
"async",
"def",
"test_abort_if_already_setup",
"(",
"hass",
")",
":",
"flow",
"=",
"init_config_flow",
"(",
"hass",
")",
"MockConfigEntry",
"(",
"domain",
"=",
"config_flow",
".",
"DOMAIN",
")",
".",
"add_to_hass",
"(",
"hass",
")",
"result",
"=",
"await",
"... | [
120,
0
] | [
144,
47
] | python | en | ['en', 'zu', 'en'] | True |
test_abort_if_authorize_fails | (
hass, mock_logi_circle, side_effect, error
) | Test we abort if authorizing fails. | Test we abort if authorizing fails. | async def test_abort_if_authorize_fails(
hass, mock_logi_circle, side_effect, error
): # pylint: disable=redefined-outer-name
"""Test we abort if authorizing fails."""
flow = init_config_flow(hass)
mock_logi_circle.authorize.side_effect = side_effect
result = await flow.async_step_code("123ABC")
... | [
"async",
"def",
"test_abort_if_authorize_fails",
"(",
"hass",
",",
"mock_logi_circle",
",",
"side_effect",
",",
"error",
")",
":",
"# pylint: disable=redefined-outer-name",
"flow",
"=",
"init_config_flow",
"(",
"hass",
")",
"mock_logi_circle",
".",
"authorize",
".",
"... | [
154,
0
] | [
166,
44
] | python | en | ['en', 'zu', 'en'] | True |
test_not_pick_implementation_if_only_one | (hass) | Test we bypass picking implementation if we have one flow_imp. | Test we bypass picking implementation if we have one flow_imp. | async def test_not_pick_implementation_if_only_one(hass):
"""Test we bypass picking implementation if we have one flow_imp."""
flow = init_config_flow(hass)
result = await flow.async_step_user()
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "auth" | [
"async",
"def",
"test_not_pick_implementation_if_only_one",
"(",
"hass",
")",
":",
"flow",
"=",
"init_config_flow",
"(",
"hass",
")",
"result",
"=",
"await",
"flow",
".",
"async_step_user",
"(",
")",
"assert",
"result",
"[",
"\"type\"",
"]",
"==",
"data_entry_fl... | [
169,
0
] | [
175,
38
] | python | en | ['en', 'en', 'en'] | True |
test_gen_auth_url | (
hass, mock_logi_circle
) | Test generating authorize URL from Logi Circle API. | Test generating authorize URL from Logi Circle API. | async def test_gen_auth_url(
hass, mock_logi_circle
): # pylint: disable=redefined-outer-name
"""Test generating authorize URL from Logi Circle API."""
config_flow.register_flow_implementation(
hass,
"test-auth-url",
client_id="id",
client_secret="secret",
api_key="1... | [
"async",
"def",
"test_gen_auth_url",
"(",
"hass",
",",
"mock_logi_circle",
")",
":",
"# pylint: disable=redefined-outer-name",
"config_flow",
".",
"register_flow_implementation",
"(",
"hass",
",",
"\"test-auth-url\"",
",",
"client_id",
"=",
"\"id\"",
",",
"client_secret",... | [
178,
0
] | [
197,
43
] | python | en | ['en', 'zu', 'en'] | True |
test_callback_view_rejects_missing_code | (hass) | Test the auth callback view rejects requests with no code. | Test the auth callback view rejects requests with no code. | async def test_callback_view_rejects_missing_code(hass):
"""Test the auth callback view rejects requests with no code."""
view = LogiCircleAuthCallbackView()
resp = await view.get(MockRequest(hass, {}))
assert resp.status == 400 | [
"async",
"def",
"test_callback_view_rejects_missing_code",
"(",
"hass",
")",
":",
"view",
"=",
"LogiCircleAuthCallbackView",
"(",
")",
"resp",
"=",
"await",
"view",
".",
"get",
"(",
"MockRequest",
"(",
"hass",
",",
"{",
"}",
")",
")",
"assert",
"resp",
".",
... | [
200,
0
] | [
205,
29
] | python | en | ['en', 'en', 'en'] | True |
test_callback_view_accepts_code | (
hass, mock_logi_circle
) | Test the auth callback view handles requests with auth code. | Test the auth callback view handles requests with auth code. | async def test_callback_view_accepts_code(
hass, mock_logi_circle
): # pylint: disable=redefined-outer-name
"""Test the auth callback view handles requests with auth code."""
init_config_flow(hass)
view = LogiCircleAuthCallbackView()
resp = await view.get(MockRequest(hass, {"code": "456"}))
as... | [
"async",
"def",
"test_callback_view_accepts_code",
"(",
"hass",
",",
"mock_logi_circle",
")",
":",
"# pylint: disable=redefined-outer-name",
"init_config_flow",
"(",
"hass",
")",
"view",
"=",
"LogiCircleAuthCallbackView",
"(",
")",
"resp",
"=",
"await",
"view",
".",
"... | [
208,
0
] | [
219,
56
] | python | en | ['en', 'en', 'en'] | True |
MockRequest.__init__ | (self, hass, query) | Init request object. | Init request object. | def __init__(self, hass, query):
"""Init request object."""
self.app = {"hass": hass}
self.query = query | [
"def",
"__init__",
"(",
"self",
",",
"hass",
",",
"query",
")",
":",
"self",
".",
"app",
"=",
"{",
"\"hass\"",
":",
"hass",
"}",
"self",
".",
"query",
"=",
"query"
] | [
21,
4
] | [
24,
26
] | python | en | ['en', 'en', 'en'] | True |
test_post_update_no_options_registered | (insights_config, insights_client) |
Client run with no options.
If registered, exit with 0 exit code (don't kill parent)
|
Client run with no options.
If registered, exit with 0 exit code (don't kill parent)
| def test_post_update_no_options_registered(insights_config, insights_client):
"""
Client run with no options.
If registered, exit with 0 exit code (don't kill parent)
"""
insights_client.return_value.get_registration_status = MagicMock(return_value=True)
with raises(SystemExit) as exc_info:
... | [
"def",
"test_post_update_no_options_registered",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"insights_client",
".",
"return_value",
".",
"get_registration_status",
"=",
"MagicMock",
"(",
"return_value",
"=",
"True",
")",
"with",
"raises",
"(",
"SystemExit... | [
32,
0
] | [
44,
69
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_no_options_unregistered | (insights_config, insights_client) |
Client run with no options.
If unregistered, exit with 101 exit code (kill parent)
|
Client run with no options.
If unregistered, exit with 101 exit code (kill parent)
| def test_post_update_no_options_unregistered(insights_config, insights_client):
"""
Client run with no options.
If unregistered, exit with 101 exit code (kill parent)
"""
insights_client.return_value.get_registration_status = MagicMock(return_value=False)
with raises(SystemExit) as exc_info:... | [
"def",
"test_post_update_no_options_unregistered",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"insights_client",
".",
"return_value",
".",
"get_registration_status",
"=",
"MagicMock",
"(",
"return_value",
"=",
"False",
")",
"with",
"raises",
"(",
"SystemE... | [
49,
0
] | [
61,
69
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_no_options_err_reg_check | (insights_config, insights_client) |
Client run with no options.
If registration check fails, exit with 101 exit code
|
Client run with no options.
If registration check fails, exit with 101 exit code
| def test_post_update_no_options_err_reg_check(insights_config, insights_client):
"""
Client run with no options.
If registration check fails, exit with 101 exit code
"""
insights_client.return_value.get_registration_status = MagicMock(return_value=None)
with raises(SystemExit) as exc_info:
... | [
"def",
"test_post_update_no_options_err_reg_check",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"insights_client",
".",
"return_value",
".",
"get_registration_status",
"=",
"MagicMock",
"(",
"return_value",
"=",
"None",
")",
"with",
"raises",
"(",
"SystemE... | [
66,
0
] | [
78,
69
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_check_status_registered | (insights_config, insights_client) |
Just check status.
If registered, exit with 100 exit code (kill parent)
|
Just check status.
If registered, exit with 100 exit code (kill parent)
| def test_post_update_check_status_registered(insights_config, insights_client):
"""
Just check status.
If registered, exit with 100 exit code (kill parent)
"""
insights_config.return_value.load_all.return_value.status = True
insights_client.return_value.get_registration_status = MagicMock(re... | [
"def",
"test_post_update_check_status_registered",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"status",
"=",
"True",
"insights_client",
".",
"return_value",
".",
"get_regis... | [
83,
0
] | [
96,
69
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_check_status_unregistered | (insights_config, insights_client) |
Just check status.
If unregistered, exit with 101 exit code (kill parent)
|
Just check status.
If unregistered, exit with 101 exit code (kill parent)
| def test_post_update_check_status_unregistered(insights_config, insights_client):
"""
Just check status.
If unregistered, exit with 101 exit code (kill parent)
"""
insights_config.return_value.load_all.return_value.status = True
insights_client.return_value.get_registration_status = MagicMoc... | [
"def",
"test_post_update_check_status_unregistered",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"status",
"=",
"True",
"insights_client",
".",
"return_value",
".",
"get_reg... | [
101,
0
] | [
114,
69
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_register_registered | (insights_config, insights_client, get_scheduler) |
Client run with --register.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
|
Client run with --register.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
| def test_post_update_register_registered(insights_config, insights_client, get_scheduler):
"""
Client run with --register.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
"""
insights_config.return_value.load_all.return_value.register = True
insights_... | [
"def",
"test_post_update_register_registered",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"register",
"=",
"True",
"insights_client",
".",
"return_val... | [
120,
0
] | [
135,
60
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_register_unregistered | (insights_config, insights_client, get_scheduler) |
Client run with --register.
If unregistered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
|
Client run with --register.
If unregistered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
| def test_post_update_register_unregistered(insights_config, insights_client, get_scheduler):
"""
Client run with --register.
If unregistered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
"""
insights_config.return_value.load_all.return_value.register = True
insig... | [
"def",
"test_post_update_register_unregistered",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"register",
"=",
"True",
"insights_client",
".",
"return_v... | [
141,
0
] | [
156,
60
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_unregister_registered | (insights_config, insights_client, get_scheduler) |
Client run with --unregister.
If registered, exit with 100 exit code
Also disable scheduling.
|
Client run with --unregister.
If registered, exit with 100 exit code
Also disable scheduling.
| def test_post_update_unregister_registered(insights_config, insights_client, get_scheduler):
"""
Client run with --unregister.
If registered, exit with 100 exit code
Also disable scheduling.
"""
insights_config.return_value.load_all.return_value.unregister = True
insights_client.retu... | [
"def",
"test_post_update_unregister_registered",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"unregister",
"=",
"True",
"insights_client",
".",
"return... | [
162,
0
] | [
177,
69
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_unregister_unregistered | (insights_config, insights_client, get_scheduler) |
Client run with --unregister.
If unregistered, exit with 101 exit code
|
Client run with --unregister.
If unregistered, exit with 101 exit code
| def test_post_update_unregister_unregistered(insights_config, insights_client, get_scheduler):
"""
Client run with --unregister.
If unregistered, exit with 101 exit code
"""
insights_config.return_value.load_all.return_value.unregister = True
insights_client.return_value.get_registration_sta... | [
"def",
"test_post_update_unregister_unregistered",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"unregister",
"=",
"True",
"insights_client",
".",
"retu... | [
183,
0
] | [
197,
68
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_force_register_registered | (insights_config, insights_client, get_scheduler) |
Client run with --force-reregister.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
|
Client run with --force-reregister.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
| def test_post_update_force_register_registered(insights_config, insights_client, get_scheduler):
"""
Client run with --force-reregister.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
"""
insights_config.return_value.load_all.return_value.register = True... | [
"def",
"test_post_update_force_register_registered",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"register",
"=",
"True",
"insights_config",
".",
"retu... | [
203,
0
] | [
219,
60
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_force_register_unregistered | (insights_config, insights_client, get_scheduler) |
Client run with --force-reregister.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
|
Client run with --force-reregister.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
| def test_post_update_force_register_unregistered(insights_config, insights_client, get_scheduler):
"""
Client run with --force-reregister.
If registered, exit with 0 exit code (don't kill parent)
Also enable scheduling.
"""
insights_config.return_value.load_all.return_value.register = Tr... | [
"def",
"test_post_update_force_register_unregistered",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"register",
"=",
"True",
"insights_config",
".",
"re... | [
225,
0
] | [
241,
60
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_set_display_name_cli_no_register_unreg | (insights_config, insights_client, get_scheduler) |
Client is unregistered, and run with --display-name but not --register
Should exit with code 101 after registration check
|
Client is unregistered, and run with --display-name but not --register
Should exit with code 101 after registration check
| def test_post_update_set_display_name_cli_no_register_unreg(insights_config, insights_client, get_scheduler):
"""
Client is unregistered, and run with --display-name but not --register
Should exit with code 101 after registration check
"""
insights_config.return_value.load_all.return_value.displ... | [
"def",
"test_post_update_set_display_name_cli_no_register_unreg",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"display_name",
"=",
"True",
"insights_config... | [
247,
0
] | [
261,
59
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_set_display_name_cli_no_register_reg | (insights_config, insights_client, get_scheduler) |
Client is registered, and run with --display-name but not --register
Should exit with code 100 after setting display name
|
Client is registered, and run with --display-name but not --register
Should exit with code 100 after setting display name
| def test_post_update_set_display_name_cli_no_register_reg(insights_config, insights_client, get_scheduler):
"""
Client is registered, and run with --display-name but not --register
Should exit with code 100 after setting display name
"""
insights_config.return_value.load_all.return_value.display... | [
"def",
"test_post_update_set_display_name_cli_no_register_reg",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"display_name",
"=",
"True",
"insights_config",... | [
267,
0
] | [
281,
59
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_set_display_name_cli_register | (insights_config, insights_client, get_scheduler) |
Client is and run with --display-name and --register
Should set schedule and exit with code 0
Display name is not explicitly set here
|
Client is and run with --display-name and --register
Should set schedule and exit with code 0
Display name is not explicitly set here
| def test_post_update_set_display_name_cli_register(insights_config, insights_client, get_scheduler):
"""
Client is and run with --display-name and --register
Should set schedule and exit with code 0
Display name is not explicitly set here
"""
insights_config.return_value.load_all.return_... | [
"def",
"test_post_update_set_display_name_cli_register",
"(",
"insights_config",
",",
"insights_client",
",",
"get_scheduler",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"register",
"=",
"True",
"insights_config",
".",
"... | [
287,
0
] | [
303,
60
] | python | en | ['en', 'error', 'th'] | False |
test_post_update_offline | (insights_config, insights_client) |
Offline mode short circuits this phase
|
Offline mode short circuits this phase
| def test_post_update_offline(insights_config, insights_client):
"""
Offline mode short circuits this phase
"""
insights_config.return_value.load_all.return_value.offline = True
try:
post_update()
except SystemExit:
pass
insights_client.return_value.get_machine_id.assert_calle... | [
"def",
"test_post_update_offline",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"insights_config",
".",
"return_value",
".",
"load_all",
".",
"return_value",
".",
"offline",
"=",
"True",
"try",
":",
"post_update",
"(",
")",
"except",
"SystemExit",
":"... | [
308,
0
] | [
320,
69
] | python | en | ['en', 'error', 'th'] | False |
test_exit_ok | (insights_config, insights_client) |
Support collection replaces the normal client run.
|
Support collection replaces the normal client run.
| def test_exit_ok(insights_config, insights_client):
"""
Support collection replaces the normal client run.
"""
with raises(SystemExit) as exc_info:
post_update()
assert exc_info.value.code == 0 | [
"def",
"test_exit_ok",
"(",
"insights_config",
",",
"insights_client",
")",
":",
"with",
"raises",
"(",
"SystemExit",
")",
"as",
"exc_info",
":",
"post_update",
"(",
")",
"assert",
"exc_info",
".",
"value",
".",
"code",
"==",
"0"
] | [
326,
0
] | [
332,
35
] | python | en | ['en', 'error', 'th'] | False |
pr_builds | (path) | Return {job: [(build, {started.json}, {finished.json})]} for each job under gcs path. | Return {job: [(build, {started.json}, {finished.json})]} for each job under gcs path. | def pr_builds(path):
"""Return {job: [(build, {started.json}, {finished.json})]} for each job under gcs path."""
jobs_dirs_fut = gcs_async.listdirs(path)
def base(path):
return os.path.basename(os.path.dirname(path))
jobs_futures = [(job, gcs_async.listdirs(job)) for job in jobs_dirs_fut.get_r... | [
"def",
"pr_builds",
"(",
"path",
")",
":",
"jobs_dirs_fut",
"=",
"gcs_async",
".",
"listdirs",
"(",
"path",
")",
"def",
"base",
"(",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"basename",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
... | [
29,
0
] | [
54,
15
] | python | en | ['en', 'da', 'en'] | True |
pr_path | (org, repo, pr, default_org, default_repo, pull_prefix) | Builds the correct gs://prefix/maybe_kubernetes/maybe_repo_org/pr. | Builds the correct gs://prefix/maybe_kubernetes/maybe_repo_org/pr. | def pr_path(org, repo, pr, default_org, default_repo, pull_prefix):
"""Builds the correct gs://prefix/maybe_kubernetes/maybe_repo_org/pr."""
if org == default_org and repo == default_repo:
return '%s/%s' % (pull_prefix, pr)
if org == default_org:
return '%s/%s/%s' % (pull_prefix, repo, pr)
... | [
"def",
"pr_path",
"(",
"org",
",",
"repo",
",",
"pr",
",",
"default_org",
",",
"default_repo",
",",
"pull_prefix",
")",
":",
"if",
"org",
"==",
"default_org",
"and",
"repo",
"==",
"default_repo",
":",
"return",
"'%s/%s'",
"%",
"(",
"pull_prefix",
",",
"p... | [
57,
0
] | [
63,
55
] | python | en | ['en', 'en', 'en'] | True |
org_repo | (path, default_org, default_repo) | Converts /maybe_org/maybe_repo into (org, repo). | Converts /maybe_org/maybe_repo into (org, repo). | def org_repo(path, default_org, default_repo):
"""Converts /maybe_org/maybe_repo into (org, repo)."""
parts = path.split('/')[1:]
if len(parts) == 2:
org, repo = parts
elif len(parts) == 1:
org = default_org
repo = parts[0]
else:
org = default_org
repo = defau... | [
"def",
"org_repo",
"(",
"path",
",",
"default_org",
",",
"default_repo",
")",
":",
"parts",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
"[",
"1",
":",
"]",
"if",
"len",
"(",
"parts",
")",
"==",
"2",
":",
"org",
",",
"repo",
"=",
"parts",
"elif",
... | [
66,
0
] | [
77,
20
] | python | en | ['it', 'en', 'en'] | True |
mock_config_entry | () | Return the default mocked config entry. | Return the default mocked config entry. | def mock_config_entry() -> MockConfigEntry:
"""Return the default mocked config entry."""
return MockConfigEntry(
title="monitor",
domain=DOMAIN,
data={CONF_HOST: "example"},
unique_id="unique_thingy",
) | [
"def",
"mock_config_entry",
"(",
")",
"->",
"MockConfigEntry",
":",
"return",
"MockConfigEntry",
"(",
"title",
"=",
"\"monitor\"",
",",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"\"example\"",
"}",
",",
"unique_id",
"=",
"\"unique_thing... | [
15,
0
] | [
22,
5
] | python | en | ['en', 'da', 'en'] | True |
mock_p1monitor | () | Return a mocked P1 Monitor client. | Return a mocked P1 Monitor client. | def mock_p1monitor():
"""Return a mocked P1 Monitor client."""
with patch("homeassistant.components.p1_monitor.P1Monitor") as p1monitor_mock:
client = p1monitor_mock.return_value
client.smartmeter = AsyncMock(
return_value=SmartMeter.from_dict(
json.loads(load_fixture... | [
"def",
"mock_p1monitor",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.p1_monitor.P1Monitor\"",
")",
"as",
"p1monitor_mock",
":",
"client",
"=",
"p1monitor_mock",
".",
"return_value",
"client",
".",
"smartmeter",
"=",
"AsyncMock",
"(",
"return_value... | [
26,
0
] | [
45,
28
] | python | en | ['en', 'en', 'en'] | True |
init_integration | (
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_p1monitor: MagicMock
) | Set up the P1 Monitor integration for testing. | Set up the P1 Monitor integration for testing. | async def init_integration(
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_p1monitor: MagicMock
) -> MockConfigEntry:
"""Set up the P1 Monitor integration for testing."""
mock_config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.... | [
"async",
"def",
"init_integration",
"(",
"hass",
":",
"HomeAssistant",
",",
"mock_config_entry",
":",
"MockConfigEntry",
",",
"mock_p1monitor",
":",
"MagicMock",
")",
"->",
"MockConfigEntry",
":",
"mock_config_entry",
".",
"add_to_hass",
"(",
"hass",
")",
"await",
... | [
49,
0
] | [
58,
28
] | python | en | ['en', 'en', 'en'] | True |
TestShapeOrNull.testShapeOrNull | (self) | Test ShapeOrNull | Test ShapeOrNull | def testShapeOrNull(self):
"""Test ShapeOrNull"""
# FIXME: construct object with mandatory attributes with example values
# model = ShapeOrNull() # noqa: E501
pass | [
"def",
"testShapeOrNull",
"(",
"self",
")",
":",
"# FIXME: construct object with mandatory attributes with example values",
"# model = ShapeOrNull() # noqa: E501",
"pass"
] | [
32,
4
] | [
36,
12
] | python | cy | ['en', 'cy', 'hi'] | False |
test_setup_with_config | (hass) | Test setup component with config. | Test setup component with config. | async def test_setup_with_config(hass):
"""Test setup component with config."""
config = {
SENSOR_DOMAIN: [
{"platform": DOMAIN, CONF_HOST: HOST, CONF_PORT: PORT},
{"platform": DOMAIN, CONF_HOST: HOST, CONF_PORT: 888},
],
}
assert await async_setup_component(hass,... | [
"async",
"def",
"test_setup_with_config",
"(",
"hass",
")",
":",
"config",
"=",
"{",
"SENSOR_DOMAIN",
":",
"[",
"{",
"\"platform\"",
":",
"DOMAIN",
",",
"CONF_HOST",
":",
"HOST",
",",
"CONF_PORT",
":",
"PORT",
"}",
",",
"{",
"\"platform\"",
":",
"DOMAIN",
... | [
22,
0
] | [
45,
62
] | python | en | ['en', 'en', 'en'] | True |
test_update_unique_id | (hass) | Test updating a config entry without a unique_id. | Test updating a config entry without a unique_id. | async def test_update_unique_id(hass):
"""Test updating a config entry without a unique_id."""
entry = MockConfigEntry(domain=DOMAIN, data={CONF_HOST: HOST, CONF_PORT: PORT})
entry.add_to_hass(hass)
config_entries = hass.config_entries.async_entries(DOMAIN)
assert len(config_entries) == 1
asser... | [
"async",
"def",
"test_update_unique_id",
"(",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"HOST",
",",
"CONF_PORT",
":",
"PORT",
"}",
")",
"entry",
".",
"add_to_hass",
"(",
"ha... | [
48,
0
] | [
66,
46
] | python | en | ['en', 'en', 'en'] | True |
test_unload_config_entry | (mock_now, hass) | Test unloading a config entry. | Test unloading a config entry. | async def test_unload_config_entry(mock_now, hass):
"""Test unloading a config entry."""
entry = MockConfigEntry(
domain=DOMAIN,
data={CONF_HOST: HOST, CONF_PORT: PORT},
unique_id=f"{HOST}:{PORT}",
)
entry.add_to_hass(hass)
config_entries = hass.config_entries.async_entries(... | [
"async",
"def",
"test_unload_config_entry",
"(",
"mock_now",
",",
"hass",
")",
":",
"entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"CONF_HOST",
":",
"HOST",
",",
"CONF_PORT",
":",
"PORT",
"}",
",",
"unique_id",
"=",
... | [
70,
0
] | [
106,
24
] | python | en | ['en', 'en', 'en'] | True |
_async_reproduce_state | (
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) | Reproduce a single state. | Reproduce a single state. | async def _async_reproduce_state(
hass: HomeAssistant,
state: State,
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) -> None:
"""Reproduce a single state."""
cur_state = hass.states.get(state.entity_id)
if cur_state is None:
_LOGGER.warning(... | [
"async",
"def",
"_async_reproduce_state",
"(",
"hass",
":",
"HomeAssistant",
",",
"state",
":",
"State",
",",
"*",
",",
"context",
":",
"Context",
"|",
"None",
"=",
"None",
",",
"reproduce_options",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
... | [
16,
0
] | [
47,
5
] | python | en | ['en', 'en', 'en'] | True |
async_reproduce_states | (
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) | Reproduce multiple Number states. | Reproduce multiple Number states. | async def async_reproduce_states(
hass: HomeAssistant,
states: Iterable[State],
*,
context: Context | None = None,
reproduce_options: dict[str, Any] | None = None,
) -> None:
"""Reproduce multiple Number states."""
# Reproduce states in parallel.
await asyncio.gather(
*(
... | [
"async",
"def",
"async_reproduce_states",
"(",
"hass",
":",
"HomeAssistant",
",",
"states",
":",
"Iterable",
"[",
"State",
"]",
",",
"*",
",",
"context",
":",
"Context",
"|",
"None",
"=",
"None",
",",
"reproduce_options",
":",
"dict",
"[",
"str",
",",
"A... | [
50,
0
] | [
66,
5
] | python | en | ['en', 'en', 'en'] | True |
mock_login | () | Mock pymelcloud login. | Mock pymelcloud login. | def mock_login():
"""Mock pymelcloud login."""
with patch(
"homeassistant.components.melcloud.config_flow.pymelcloud.login"
) as mock:
mock.return_value = "test-token"
yield mock | [
"def",
"mock_login",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melcloud.config_flow.pymelcloud.login\"",
")",
"as",
"mock",
":",
"mock",
".",
"return_value",
"=",
"\"test-token\"",
"yield",
"mock"
] | [
16,
0
] | [
22,
18
] | python | en | ['nl', 'ht', 'en'] | False |
mock_get_devices | () | Mock pymelcloud get_devices. | Mock pymelcloud get_devices. | def mock_get_devices():
"""Mock pymelcloud get_devices."""
with patch(
"homeassistant.components.melcloud.config_flow.pymelcloud.get_devices"
) as mock:
mock.return_value = {
pymelcloud.DEVICE_TYPE_ATA: [],
pymelcloud.DEVICE_TYPE_ATW: [],
}
yield mock | [
"def",
"mock_get_devices",
"(",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melcloud.config_flow.pymelcloud.get_devices\"",
")",
"as",
"mock",
":",
"mock",
".",
"return_value",
"=",
"{",
"pymelcloud",
".",
"DEVICE_TYPE_ATA",
":",
"[",
"]",
",",
"pyme... | [
26,
0
] | [
35,
18
] | python | en | ['nl', 'en', 'en'] | True |
mock_request_info | () | Mock RequestInfo to create ClientResponseErrors. | Mock RequestInfo to create ClientResponseErrors. | def mock_request_info():
"""Mock RequestInfo to create ClientResponseErrors."""
with patch("aiohttp.RequestInfo") as mock_ri:
mock_ri.return_value.real_url.return_value = ""
yield mock_ri | [
"def",
"mock_request_info",
"(",
")",
":",
"with",
"patch",
"(",
"\"aiohttp.RequestInfo\"",
")",
"as",
"mock_ri",
":",
"mock_ri",
".",
"return_value",
".",
"real_url",
".",
"return_value",
"=",
"\"\"",
"yield",
"mock_ri"
] | [
39,
0
] | [
43,
21
] | python | en | ['en', 'sr', 'en'] | True |
test_form | (hass, mock_login, mock_get_devices) | Test we get the form. | Test we get the form. | async def test_form(hass, mock_login, mock_get_devices):
"""Test we get the form."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}
)
assert result["type"] == "form"
assert result["errors"] is None
with patch(
"homeassi... | [
"async",
"def",
"test_form",
"(",
"hass",
",",
"mock_login",
",",
"mock_get_devices",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"config_entries... | [
46,
0
] | [
72,
48
] | python | en | ['en', 'en', 'en'] | True |
test_form_errors | (hass, mock_login, mock_get_devices, error, reason) | Test we handle cannot connect error. | Test we handle cannot connect error. | async def test_form_errors(hass, mock_login, mock_get_devices, error, reason):
"""Test we handle cannot connect error."""
mock_login.side_effect = error
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data={"username": "tes... | [
"async",
"def",
"test_form_errors",
"(",
"hass",
",",
"mock_login",
",",
"mock_get_devices",
",",
"error",
",",
"reason",
")",
":",
"mock_login",
".",
"side_effect",
"=",
"error",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"asyn... | [
79,
0
] | [
91,
37
] | python | en | ['en', 'en', 'en'] | True |
test_form_response_errors | (
hass, mock_login, mock_get_devices, mock_request_info, error, message
) | Test we handle response errors. | Test we handle response errors. | async def test_form_response_errors(
hass, mock_login, mock_get_devices, mock_request_info, error, message
):
"""Test we handle response errors."""
mock_login.side_effect = ClientResponseError(mock_request_info(), (), status=error)
result = await hass.config_entries.flow.async_init(
DOMAIN,
... | [
"async",
"def",
"test_form_response_errors",
"(",
"hass",
",",
"mock_login",
",",
"mock_get_devices",
",",
"mock_request_info",
",",
"error",
",",
"message",
")",
":",
"mock_login",
".",
"side_effect",
"=",
"ClientResponseError",
"(",
"mock_request_info",
"(",
")",
... | [
102,
0
] | [
115,
38
] | python | de | ['de', 'sr', 'en'] | False |
test_import_with_token | (hass, mock_login, mock_get_devices) | Test successful import. | Test successful import. | async def test_import_with_token(hass, mock_login, mock_get_devices):
"""Test successful import."""
with patch(
"homeassistant.components.melcloud.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.melcloud.async_setup_entry", return_value=True
) as mock_se... | [
"async",
"def",
"test_import_with_token",
"(",
"hass",
",",
"mock_login",
",",
"mock_get_devices",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.melcloud.async_setup\"",
",",
"return_value",
"=",
"True",
")",
"as",
"mock_setup",
",",
"patch",
"(",
"\"h... | [
118,
0
] | [
139,
48
] | python | en | ['en', 'la', 'en'] | True |
test_token_refresh | (hass, mock_login, mock_get_devices) | Re-configuration with existing username should refresh token. | Re-configuration with existing username should refresh token. | async def test_token_refresh(hass, mock_login, mock_get_devices):
"""Re-configuration with existing username should refresh token."""
mock_entry = MockConfigEntry(
domain=DOMAIN,
data={"username": "test-email@test-domain.com", "token": "test-original-token"},
unique_id="test-email@test-d... | [
"async",
"def",
"test_token_refresh",
"(",
"hass",
",",
"mock_login",
",",
"mock_get_devices",
")",
":",
"mock_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"DOMAIN",
",",
"data",
"=",
"{",
"\"username\"",
":",
"\"test-email@test-domain.com\"",
",",
"\"token... | [
142,
0
] | [
176,
46
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, config_entry, async_add_entities) | Set up the Insteon climate entities from a config entry. | Set up the Insteon climate entities from a config entry. | async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Insteon climate entities from a config entry."""
@callback
def async_add_insteon_climate_entities(discovery_info=None):
"""Add the Insteon entities for the platform."""
async_add_insteon_entities(
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
")",
":",
"@",
"callback",
"def",
"async_add_insteon_climate_entities",
"(",
"discovery_info",
"=",
"None",
")",
":",
"\"\"\"Add the Insteon entities for the platform.\"\"\"",
... | [
64,
0
] | [
80,
40
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.supported_features | (self) | Return the supported features for this entity. | Return the supported features for this entity. | def supported_features(self):
"""Return the supported features for this entity."""
return SUPPORTED_FEATURES | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORTED_FEATURES"
] | [
87,
4
] | [
89,
33
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.temperature_unit | (self) | Return the unit of measurement. | Return the unit of measurement. | def temperature_unit(self) -> str:
"""Return the unit of measurement."""
if self._insteon_device.properties[CELSIUS].value:
return TEMP_CELSIUS
return TEMP_FAHRENHEIT | [
"def",
"temperature_unit",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"_insteon_device",
".",
"properties",
"[",
"CELSIUS",
"]",
".",
"value",
":",
"return",
"TEMP_CELSIUS",
"return",
"TEMP_FAHRENHEIT"
] | [
92,
4
] | [
96,
30
] | python | en | ['en', 'la', 'en'] | True |
InsteonClimateEntity.current_humidity | (self) | Return the current humidity. | Return the current humidity. | def current_humidity(self) -> int | None:
"""Return the current humidity."""
return self._insteon_device.groups[HUMIDITY].value | [
"def",
"current_humidity",
"(",
"self",
")",
"->",
"int",
"|",
"None",
":",
"return",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"HUMIDITY",
"]",
".",
"value"
] | [
99,
4
] | [
101,
58
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.hvac_mode | (self) | Return hvac operation ie. heat, cool mode. | Return hvac operation ie. heat, cool mode. | def hvac_mode(self) -> str:
"""Return hvac operation ie. heat, cool mode."""
return HVAC_MODES[self._insteon_device.groups[SYSTEM_MODE].value] | [
"def",
"hvac_mode",
"(",
"self",
")",
"->",
"str",
":",
"return",
"HVAC_MODES",
"[",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"SYSTEM_MODE",
"]",
".",
"value",
"]"
] | [
104,
4
] | [
106,
73
] | python | bg | ['en', 'bg', 'bg'] | True |
InsteonClimateEntity.hvac_modes | (self) | Return the list of available hvac operation modes. | Return the list of available hvac operation modes. | def hvac_modes(self) -> list[str]:
"""Return the list of available hvac operation modes."""
return list(HVAC_MODES.values()) | [
"def",
"hvac_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"return",
"list",
"(",
"HVAC_MODES",
".",
"values",
"(",
")",
")"
] | [
109,
4
] | [
111,
40
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.current_temperature | (self) | Return the current temperature. | Return the current temperature. | def current_temperature(self) -> float | None:
"""Return the current temperature."""
return self._insteon_device.groups[TEMPERATURE].value | [
"def",
"current_temperature",
"(",
"self",
")",
"->",
"float",
"|",
"None",
":",
"return",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"TEMPERATURE",
"]",
".",
"value"
] | [
114,
4
] | [
116,
61
] | python | en | ['en', 'la', 'en'] | True |
InsteonClimateEntity.target_temperature | (self) | Return the temperature we try to reach. | Return the temperature we try to reach. | def target_temperature(self) -> float | None:
"""Return the temperature we try to reach."""
if self._insteon_device.groups[SYSTEM_MODE].value == ThermostatMode.HEAT:
return self._insteon_device.groups[HEAT_SET_POINT].value
if self._insteon_device.groups[SYSTEM_MODE].value == Thermost... | [
"def",
"target_temperature",
"(",
"self",
")",
"->",
"float",
"|",
"None",
":",
"if",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"SYSTEM_MODE",
"]",
".",
"value",
"==",
"ThermostatMode",
".",
"HEAT",
":",
"return",
"self",
".",
"_insteon_device",
... | [
119,
4
] | [
125,
19
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.target_temperature_high | (self) | Return the highbound target temperature we try to reach. | Return the highbound target temperature we try to reach. | def target_temperature_high(self) -> float | None:
"""Return the highbound target temperature we try to reach."""
if self._insteon_device.groups[SYSTEM_MODE].value == ThermostatMode.AUTO:
return self._insteon_device.groups[COOL_SET_POINT].value
return None | [
"def",
"target_temperature_high",
"(",
"self",
")",
"->",
"float",
"|",
"None",
":",
"if",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"SYSTEM_MODE",
"]",
".",
"value",
"==",
"ThermostatMode",
".",
"AUTO",
":",
"return",
"self",
".",
"_insteon_device... | [
128,
4
] | [
132,
19
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.target_temperature_low | (self) | Return the lowbound target temperature we try to reach. | Return the lowbound target temperature we try to reach. | def target_temperature_low(self) -> float | None:
"""Return the lowbound target temperature we try to reach."""
if self._insteon_device.groups[SYSTEM_MODE].value == ThermostatMode.AUTO:
return self._insteon_device.groups[HEAT_SET_POINT].value
return None | [
"def",
"target_temperature_low",
"(",
"self",
")",
"->",
"float",
"|",
"None",
":",
"if",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"SYSTEM_MODE",
"]",
".",
"value",
"==",
"ThermostatMode",
".",
"AUTO",
":",
"return",
"self",
".",
"_insteon_device"... | [
135,
4
] | [
139,
19
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.fan_mode | (self) | Return the fan setting. | Return the fan setting. | def fan_mode(self) -> str | None:
"""Return the fan setting."""
return FAN_MODES[self._insteon_device.groups[FAN_MODE].value] | [
"def",
"fan_mode",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"return",
"FAN_MODES",
"[",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"FAN_MODE",
"]",
".",
"value",
"]"
] | [
142,
4
] | [
144,
69
] | python | en | ['en', 'fy', 'en'] | True |
InsteonClimateEntity.fan_modes | (self) | Return the list of available fan modes. | Return the list of available fan modes. | def fan_modes(self) -> list[str] | None:
"""Return the list of available fan modes."""
return list(FAN_MODES.values()) | [
"def",
"fan_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
"|",
"None",
":",
"return",
"list",
"(",
"FAN_MODES",
".",
"values",
"(",
")",
")"
] | [
147,
4
] | [
149,
39
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.target_humidity | (self) | Return the humidity we try to reach. | Return the humidity we try to reach. | def target_humidity(self) -> int | None:
"""Return the humidity we try to reach."""
high = self._insteon_device.groups[HUMIDITY_HIGH].value
low = self._insteon_device.groups[HUMIDITY_LOW].value
# May not be loaded yet so return a default if required
return (high + low) / 2 if hig... | [
"def",
"target_humidity",
"(",
"self",
")",
"->",
"int",
"|",
"None",
":",
"high",
"=",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"HUMIDITY_HIGH",
"]",
".",
"value",
"low",
"=",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"HUMIDITY_LOW",
... | [
152,
4
] | [
157,
57
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.min_humidity | (self) | Return the minimum humidity. | Return the minimum humidity. | def min_humidity(self) -> int:
"""Return the minimum humidity."""
return 1 | [
"def",
"min_humidity",
"(",
"self",
")",
"->",
"int",
":",
"return",
"1"
] | [
160,
4
] | [
162,
16
] | python | en | ['en', 'et', 'en'] | True |
InsteonClimateEntity.hvac_action | (self) | Return the current running hvac operation if supported.
Need to be one of CURRENT_HVAC_*.
| Return the current running hvac operation if supported. | def hvac_action(self) -> str | None:
"""Return the current running hvac operation if supported.
Need to be one of CURRENT_HVAC_*.
"""
if self._insteon_device.groups[COOLING].value:
return CURRENT_HVAC_COOL
if self._insteon_device.groups[HEATING].value:
re... | [
"def",
"hvac_action",
"(",
"self",
")",
"->",
"str",
"|",
"None",
":",
"if",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"COOLING",
"]",
".",
"value",
":",
"return",
"CURRENT_HVAC_COOL",
"if",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"... | [
165,
4
] | [
176,
32
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.extra_state_attributes | (self) | Provide attributes for display on device card. | Provide attributes for display on device card. | def extra_state_attributes(self):
"""Provide attributes for display on device card."""
attr = super().extra_state_attributes
humidifier = "off"
if self._insteon_device.groups[DEHUMIDIFYING].value:
humidifier = "dehumidifying"
if self._insteon_device.groups[HUMIDIFYING... | [
"def",
"extra_state_attributes",
"(",
"self",
")",
":",
"attr",
"=",
"super",
"(",
")",
".",
"extra_state_attributes",
"humidifier",
"=",
"\"off\"",
"if",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"DEHUMIDIFYING",
"]",
".",
"value",
":",
"humidifier"... | [
179,
4
] | [
188,
19
] | python | en | ['en', 'en', 'en'] | True |
InsteonClimateEntity.async_set_temperature | (self, **kwargs) | Set new target temperature. | Set new target temperature. | async def async_set_temperature(self, **kwargs) -> None:
"""Set new target temperature."""
target_temp = kwargs.get(ATTR_TEMPERATURE)
target_temp_low = kwargs.get(ATTR_TARGET_TEMP_LOW)
target_temp_high = kwargs.get(ATTR_TARGET_TEMP_HIGH)
if target_temp is not None:
if... | [
"async",
"def",
"async_set_temperature",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"target_temp",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TEMPERATURE",
")",
"target_temp_low",
"=",
"kwargs",
".",
"get",
"(",
"ATTR_TARGET_TEMP_LOW",
")",
"ta... | [
190,
4
] | [
202,
81
] | python | en | ['en', 'ca', 'en'] | True |
InsteonClimateEntity.async_set_fan_mode | (self, fan_mode: str) | Set new target fan mode. | Set new target fan mode. | async def async_set_fan_mode(self, fan_mode: str) -> None:
"""Set new target fan mode."""
mode = list(FAN_MODES)[list(FAN_MODES.values()).index(fan_mode)]
await self._insteon_device.async_set_mode(mode) | [
"async",
"def",
"async_set_fan_mode",
"(",
"self",
",",
"fan_mode",
":",
"str",
")",
"->",
"None",
":",
"mode",
"=",
"list",
"(",
"FAN_MODES",
")",
"[",
"list",
"(",
"FAN_MODES",
".",
"values",
"(",
")",
")",
".",
"index",
"(",
"fan_mode",
")",
"]",
... | [
204,
4
] | [
207,
55
] | python | en | ['sv', 'fy', 'en'] | False |
InsteonClimateEntity.async_set_hvac_mode | (self, hvac_mode: str) | Set new target hvac mode. | Set new target hvac mode. | async def async_set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target hvac mode."""
mode = list(HVAC_MODES)[list(HVAC_MODES.values()).index(hvac_mode)]
await self._insteon_device.async_set_mode(mode) | [
"async",
"def",
"async_set_hvac_mode",
"(",
"self",
",",
"hvac_mode",
":",
"str",
")",
"->",
"None",
":",
"mode",
"=",
"list",
"(",
"HVAC_MODES",
")",
"[",
"list",
"(",
"HVAC_MODES",
".",
"values",
"(",
")",
")",
".",
"index",
"(",
"hvac_mode",
")",
... | [
209,
4
] | [
212,
55
] | python | da | ['da', 'su', 'en'] | False |
InsteonClimateEntity.async_set_humidity | (self, humidity) | Set new humidity level. | Set new humidity level. | async def async_set_humidity(self, humidity):
"""Set new humidity level."""
change = humidity - self.target_humidity
high = self._insteon_device.groups[HUMIDITY_HIGH].value + change
low = self._insteon_device.groups[HUMIDITY_LOW].value + change
await self._insteon_device.async_se... | [
"async",
"def",
"async_set_humidity",
"(",
"self",
",",
"humidity",
")",
":",
"change",
"=",
"humidity",
"-",
"self",
".",
"target_humidity",
"high",
"=",
"self",
".",
"_insteon_device",
".",
"groups",
"[",
"HUMIDITY_HIGH",
"]",
".",
"value",
"+",
"change",
... | [
214,
4
] | [
220,
74
] | python | en | ['en', 'sr', 'en'] | True |
InsteonClimateEntity.async_added_to_hass | (self) | Register INSTEON update events. | Register INSTEON update events. | async def async_added_to_hass(self):
"""Register INSTEON update events."""
await super().async_added_to_hass()
await self._insteon_device.async_read_op_flags()
for group in (
COOLING,
HEATING,
DEHUMIDIFYING,
HUMIDIFYING,
HEAT_SE... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"await",
"self",
".",
"_insteon_device",
".",
"async_read_op_flags",
"(",
")",
"for",
"group",
"in",
"(",
"COOLING",
",",
"HEATING... | [
222,
4
] | [
239,
82
] | python | en | ['es', 'nl', 'en'] | False |
test_make_filter | () | Test filter. | Test filter. | def test_make_filter():
"""Test filter."""
callsigns = ["CALLSIGN1", "callsign2"]
res = device_tracker.make_filter(callsigns)
assert res == "b/CALLSIGN1 b/CALLSIGN2" | [
"def",
"test_make_filter",
"(",
")",
":",
"callsigns",
"=",
"[",
"\"CALLSIGN1\"",
",",
"\"callsign2\"",
"]",
"res",
"=",
"device_tracker",
".",
"make_filter",
"(",
"callsigns",
")",
"assert",
"res",
"==",
"\"b/CALLSIGN1 b/CALLSIGN2\""
] | [
19,
0
] | [
23,
43
] | python | en | ['en', 'da', 'en'] | False |
test_gps_accuracy_0 | () | Test GPS accuracy level 0. | Test GPS accuracy level 0. | def test_gps_accuracy_0():
"""Test GPS accuracy level 0."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 0)
assert acc == 0 | [
"def",
"test_gps_accuracy_0",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"0",
")",
"assert",
"acc",
"==",
"0"
] | [
26,
0
] | [
29,
19
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_1 | () | Test GPS accuracy level 1. | Test GPS accuracy level 1. | def test_gps_accuracy_1():
"""Test GPS accuracy level 1."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 1)
assert acc == 186 | [
"def",
"test_gps_accuracy_1",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"1",
")",
"assert",
"acc",
"==",
"186"
] | [
32,
0
] | [
35,
21
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_2 | () | Test GPS accuracy level 2. | Test GPS accuracy level 2. | def test_gps_accuracy_2():
"""Test GPS accuracy level 2."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 2)
assert acc == 1855 | [
"def",
"test_gps_accuracy_2",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"2",
")",
"assert",
"acc",
"==",
"1855"
] | [
38,
0
] | [
41,
22
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_3 | () | Test GPS accuracy level 3. | Test GPS accuracy level 3. | def test_gps_accuracy_3():
"""Test GPS accuracy level 3."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 3)
assert acc == 18553 | [
"def",
"test_gps_accuracy_3",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"3",
")",
"assert",
"acc",
"==",
"18553"
] | [
44,
0
] | [
47,
23
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_4 | () | Test GPS accuracy level 4. | Test GPS accuracy level 4. | def test_gps_accuracy_4():
"""Test GPS accuracy level 4."""
acc = device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, 4)
assert acc == 111319 | [
"def",
"test_gps_accuracy_4",
"(",
")",
":",
"acc",
"=",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"4",
")",
"assert",
"acc",
"==",
"111319"
] | [
50,
0
] | [
53,
24
] | python | en | ['en', 'ga', 'en'] | True |
test_gps_accuracy_invalid_int | () | Test GPS accuracy with invalid input. | Test GPS accuracy with invalid input. | def test_gps_accuracy_invalid_int():
"""Test GPS accuracy with invalid input."""
level = 5
try:
device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, level)
assert False, "No exception."
except ValueError:
pass | [
"def",
"test_gps_accuracy_invalid_int",
"(",
")",
":",
"level",
"=",
"5",
"try",
":",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"level",
")",
"assert",
"False",
",",
"\"No exception.\"",
"except",
"ValueError",
":",
"pass"
] | [
56,
0
] | [
64,
12
] | python | en | ['en', 'en', 'en'] | True |
test_gps_accuracy_invalid_string | () | Test GPS accuracy with invalid input. | Test GPS accuracy with invalid input. | def test_gps_accuracy_invalid_string():
"""Test GPS accuracy with invalid input."""
level = "not an int"
try:
device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, level)
assert False, "No exception."
except ValueError:
pass | [
"def",
"test_gps_accuracy_invalid_string",
"(",
")",
":",
"level",
"=",
"\"not an int\"",
"try",
":",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"level",
")",
"assert",
"False",
",",
"\"No exception.\"",
"except",
"ValueError",
":",
... | [
67,
0
] | [
75,
12
] | python | en | ['en', 'en', 'en'] | True |
test_gps_accuracy_invalid_float | () | Test GPS accuracy with invalid input. | Test GPS accuracy with invalid input. | def test_gps_accuracy_invalid_float():
"""Test GPS accuracy with invalid input."""
level = 1.2
try:
device_tracker.gps_accuracy(TEST_COORDS_NULL_ISLAND, level)
assert False, "No exception."
except ValueError:
pass | [
"def",
"test_gps_accuracy_invalid_float",
"(",
")",
":",
"level",
"=",
"1.2",
"try",
":",
"device_tracker",
".",
"gps_accuracy",
"(",
"TEST_COORDS_NULL_ISLAND",
",",
"level",
")",
"assert",
"False",
",",
"\"No exception.\"",
"except",
"ValueError",
":",
"pass"
] | [
78,
0
] | [
86,
12
] | python | en | ['en', 'en', 'en'] | True |
test_aprs_listener | () | Test listener thread. | Test listener thread. | def test_aprs_listener():
"""Test listener thread."""
with patch("aprslib.IS") as mock_ais:
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
port = DEFAULT_PORT
see = Mock()
listener = device_tracker.AprsListe... | [
"def",
"test_aprs_listener",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
"as",
"mock_ais",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"port",
"=",
"DEFAU... | [
89,
0
] | [
111,
84
] | python | en | ['en', 'de', 'en'] | True |
test_aprs_listener_start_fail | () | Test listener thread start failure. | Test listener thread start failure. | def test_aprs_listener_start_fail():
"""Test listener thread start failure."""
with patch(
"aprslib.IS.connect", side_effect=aprslib.ConnectionError("Unable to connect.")
):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER... | [
"def",
"test_aprs_listener_start_fail",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS.connect\"",
",",
"side_effect",
"=",
"aprslib",
".",
"ConnectionError",
"(",
"\"Unable to connect.\"",
")",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_... | [
114,
0
] | [
136,
61
] | python | en | ['en', 'de', 'en'] | True |
test_aprs_listener_stop | () | Test listener thread stop. | Test listener thread stop. | def test_aprs_listener_stop():
"""Test listener thread stop."""
with patch("aprslib.IS"):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
see = Mock()
listener = device_tracker.AprsListenerThread(
callsig... | [
"def",
"test_aprs_listener_stop",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"see",
"=",
"Mock",
"(",
")",
... | [
139,
0
] | [
162,
47
] | python | en | ['en', 'de', 'en'] | True |
test_aprs_listener_rx_msg | () | Test rx_msg. | Test rx_msg. | def test_aprs_listener_rx_msg():
"""Test rx_msg."""
with patch("aprslib.IS"):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
see = Mock()
sample_msg = {
device_tracker.ATTR_FORMAT: "uncompressed",
... | [
"def",
"test_aprs_listener_rx_msg",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"see",
"=",
"Mock",
"(",
")",
... | [
165,
0
] | [
199,
9
] | python | en | ['en', 'en', 'hi'] | False |
test_aprs_listener_rx_msg_ambiguity | () | Test rx_msg with posambiguity. | Test rx_msg with posambiguity. | def test_aprs_listener_rx_msg_ambiguity():
"""Test rx_msg with posambiguity."""
with patch("aprslib.IS"):
callsign = TEST_CALLSIGN
password = TEST_PASSWORD
host = TEST_HOST
server_filter = TEST_FILTER
see = Mock()
sample_msg = {
device_tracker.ATTR_FO... | [
"def",
"test_aprs_listener_rx_msg_ambiguity",
"(",
")",
":",
"with",
"patch",
"(",
"\"aprslib.IS\"",
")",
":",
"callsign",
"=",
"TEST_CALLSIGN",
"password",
"=",
"TEST_PASSWORD",
"host",
"=",
"TEST_HOST",
"server_filter",
"=",
"TEST_FILTER",
"see",
"=",
"Mock",
"(... | [
202,
0
] | [
236,
9
] | 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.