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
noiseQ
(sk, c, q)
Get the noise of a cyphertext based on the provided key.
Get the noise of a cyphertext based on the provided key.
def noiseQ(sk, c, q): """Get the noise of a cyphertext based on the provided key.""" return (c - sk*q)
[ "def", "noiseQ", "(", "sk", ",", "c", ",", "q", ")", ":", "return", "(", "c", "-", "sk", "*", "q", ")" ]
[ 62, 0 ]
[ 64, 21 ]
python
en
['en', 'en', 'en']
True
mock_connection
(aioclient_mock: AiohttpClientMocker)
Mock the DirecTV connection for Home Assistant.
Mock the DirecTV connection for Home Assistant.
def mock_connection(aioclient_mock: AiohttpClientMocker) -> None: """Mock the DirecTV connection for Home Assistant.""" aioclient_mock.get( f"http://{HOST}:8080/info/getVersion", text=load_fixture("directv/info-get-version.json"), headers={"Content-Type": CONTENT_TYPE_JSON}, ) a...
[ "def", "mock_connection", "(", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "aioclient_mock", ".", "get", "(", "f\"http://{HOST}:8080/info/getVersion\"", ",", "text", "=", "load_fixture", "(", "\"directv/info-get-version.json\"", ")", ",", "head...
[ 24, 0 ]
[ 97, 5 ]
python
en
['en', 'en', 'en']
True
setup_integration
( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker, skip_entry_setup: bool = False, setup_error: bool = False, )
Set up the DirecTV integration in Home Assistant.
Set up the DirecTV integration in Home Assistant.
async def setup_integration( hass: HomeAssistantType, aioclient_mock: AiohttpClientMocker, skip_entry_setup: bool = False, setup_error: bool = False, ) -> MockConfigEntry: """Set up the DirecTV integration in Home Assistant.""" if setup_error: aioclient_mock.get( f"http://{HO...
[ "async", "def", "setup_integration", "(", "hass", ":", "HomeAssistantType", ",", "aioclient_mock", ":", "AiohttpClientMocker", ",", "skip_entry_setup", ":", "bool", "=", "False", ",", "setup_error", ":", "bool", "=", "False", ",", ")", "->", "MockConfigEntry", "...
[ 100, 0 ]
[ 126, 16 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Set up the OTP sensor.
Set up the OTP sensor.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the OTP sensor.""" name = config.get(CONF_NAME) token = config.get(CONF_TOKEN) async_add_entities([TOTPSensor(name, token)], True) return True
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "token", "=", "config", ".", "get", "(", "CONF_TOKEN", ")...
[ 26, 0 ]
[ 32, 15 ]
python
en
['en', 'da', 'en']
True
TOTPSensor.__init__
(self, name, token)
Initialize the sensor.
Initialize the sensor.
def __init__(self, name, token): """Initialize the sensor.""" self._name = name self._otp = pyotp.TOTP(token) self._state = None self._next_expiration = None
[ "def", "__init__", "(", "self", ",", "name", ",", "token", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_otp", "=", "pyotp", ".", "TOTP", "(", "token", ")", "self", ".", "_state", "=", "None", "self", ".", "_next_expiration", "=", "No...
[ 39, 4 ]
[ 44, 36 ]
python
en
['en', 'en', 'en']
True
TOTPSensor.async_added_to_hass
(self)
Handle when an entity is about to be added to Home Assistant.
Handle when an entity is about to be added to Home Assistant.
async def async_added_to_hass(self): """Handle when an entity is about to be added to Home Assistant.""" self._call_loop()
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_call_loop", "(", ")" ]
[ 46, 4 ]
[ 48, 25 ]
python
en
['en', 'en', 'en']
True
TOTPSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 61, 4 ]
[ 63, 25 ]
python
en
['en', 'mi', 'en']
True
TOTPSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 66, 4 ]
[ 68, 26 ]
python
en
['en', 'en', 'en']
True
TOTPSensor.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self): """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 71, 4 ]
[ 73, 20 ]
python
en
['en', 'en', 'en']
True
TOTPSensor.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 ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 76, 4 ]
[ 78, 19 ]
python
en
['en', 'en', 'en']
True
build_message
(test_params, default_params)
Build a test message from overrides and another message.
Build a test message from overrides and another message.
def build_message(test_params, default_params): """Build a test message from overrides and another message.""" new_params = default_params.copy() new_params.update(test_params) return new_params
[ "def", "build_message", "(", "test_params", ",", "default_params", ")", ":", "new_params", "=", "default_params", ".", "copy", "(", ")", "new_params", ".", "update", "(", "test_params", ")", "return", "new_params" ]
[ 59, 0 ]
[ 63, 21 ]
python
en
['en', 'en', 'en']
True
setup_comp
(hass, mock_device_tracker_conf, mqtt_mock)
Initialize components.
Initialize components.
def setup_comp(hass, mock_device_tracker_conf, mqtt_mock): """Initialize components.""" assert hass.loop.run_until_complete( async_setup_component(hass, "persistent_notification", {}) ) hass.loop.run_until_complete(async_setup_component(hass, "device_tracker", {})) hass.states.async_set("zo...
[ "def", "setup_comp", "(", "hass", ",", "mock_device_tracker_conf", ",", "mqtt_mock", ")", ":", "assert", "hass", ".", "loop", ".", "run_until_complete", "(", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", ")", "hass...
[ 283, 0 ]
[ 295, 9 ]
python
en
['de', 'en', 'en']
False
setup_owntracks
(hass, config, ctx_cls=owntracks.OwnTracksContext)
Set up OwnTracks.
Set up OwnTracks.
async def setup_owntracks(hass, config, ctx_cls=owntracks.OwnTracksContext): """Set up OwnTracks.""" MockConfigEntry( domain="owntracks", data={"webhook_id": "owntracks_test", "secret": "abcd"} ).add_to_hass(hass) with patch.object(owntracks, "OwnTracksContext", ctx_cls): assert await a...
[ "async", "def", "setup_owntracks", "(", "hass", ",", "config", ",", "ctx_cls", "=", "owntracks", ".", "OwnTracksContext", ")", ":", "MockConfigEntry", "(", "domain", "=", "\"owntracks\"", ",", "data", "=", "{", "\"webhook_id\"", ":", "\"owntracks_test\"", ",", ...
[ 298, 0 ]
[ 306, 42 ]
python
en
['en', 'da', 'en']
True
context
(hass, setup_comp)
Set up the mocked context.
Set up the mocked context.
def context(hass, setup_comp): """Set up the mocked context.""" orig_context = owntracks.OwnTracksContext context = None # pylint: disable=no-value-for-parameter def store_context(*args): """Store the context.""" nonlocal context context = orig_context(*args) return...
[ "def", "context", "(", "hass", ",", "setup_comp", ")", ":", "orig_context", "=", "owntracks", ".", "OwnTracksContext", "context", "=", "None", "# pylint: disable=no-value-for-parameter", "def", "store_context", "(", "*", "args", ")", ":", "\"\"\"Store the context.\"\"...
[ 310, 0 ]
[ 339, 21 ]
python
en
['en', 'en', 'en']
True
send_message
(hass, topic, message, corrupt=False)
Test the sending of a message.
Test the sending of a message.
async def send_message(hass, topic, message, corrupt=False): """Test the sending of a message.""" str_message = json.dumps(message) if corrupt: mod_message = BAD_JSON_PREFIX + str_message + BAD_JSON_SUFFIX else: mod_message = str_message async_fire_mqtt_message(hass, topic, mod_messa...
[ "async", "def", "send_message", "(", "hass", ",", "topic", ",", "message", ",", "corrupt", "=", "False", ")", ":", "str_message", "=", "json", ".", "dumps", "(", "message", ")", "if", "corrupt", ":", "mod_message", "=", "BAD_JSON_PREFIX", "+", "str_message...
[ 342, 0 ]
[ 351, 38 ]
python
en
['en', 'en', 'en']
True
assert_location_state
(hass, location)
Test the assertion of a location state.
Test the assertion of a location state.
def assert_location_state(hass, location): """Test the assertion of a location state.""" state = hass.states.get(DEVICE_TRACKER_STATE) assert state.state == location
[ "def", "assert_location_state", "(", "hass", ",", "location", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "DEVICE_TRACKER_STATE", ")", "assert", "state", ".", "state", "==", "location" ]
[ 354, 0 ]
[ 357, 34 ]
python
en
['en', 'en', 'en']
True
assert_location_latitude
(hass, latitude)
Test the assertion of a location latitude.
Test the assertion of a location latitude.
def assert_location_latitude(hass, latitude): """Test the assertion of a location latitude.""" state = hass.states.get(DEVICE_TRACKER_STATE) assert state.attributes.get("latitude") == latitude
[ "def", "assert_location_latitude", "(", "hass", ",", "latitude", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "DEVICE_TRACKER_STATE", ")", "assert", "state", ".", "attributes", ".", "get", "(", "\"latitude\"", ")", "==", "latitude" ]
[ 360, 0 ]
[ 363, 55 ]
python
en
['en', 'en', 'en']
True
assert_location_longitude
(hass, longitude)
Test the assertion of a location longitude.
Test the assertion of a location longitude.
def assert_location_longitude(hass, longitude): """Test the assertion of a location longitude.""" state = hass.states.get(DEVICE_TRACKER_STATE) assert state.attributes.get("longitude") == longitude
[ "def", "assert_location_longitude", "(", "hass", ",", "longitude", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "DEVICE_TRACKER_STATE", ")", "assert", "state", ".", "attributes", ".", "get", "(", "\"longitude\"", ")", "==", "longitude" ]
[ 366, 0 ]
[ 369, 57 ]
python
en
['en', 'en', 'en']
True
assert_location_accuracy
(hass, accuracy)
Test the assertion of a location accuracy.
Test the assertion of a location accuracy.
def assert_location_accuracy(hass, accuracy): """Test the assertion of a location accuracy.""" state = hass.states.get(DEVICE_TRACKER_STATE) assert state.attributes.get("gps_accuracy") == accuracy
[ "def", "assert_location_accuracy", "(", "hass", ",", "accuracy", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "DEVICE_TRACKER_STATE", ")", "assert", "state", ".", "attributes", ".", "get", "(", "\"gps_accuracy\"", ")", "==", "accuracy" ]
[ 372, 0 ]
[ 375, 59 ]
python
en
['en', 'en', 'en']
True
assert_location_source_type
(hass, source_type)
Test the assertion of source_type.
Test the assertion of source_type.
def assert_location_source_type(hass, source_type): """Test the assertion of source_type.""" state = hass.states.get(DEVICE_TRACKER_STATE) assert state.attributes.get("source_type") == source_type
[ "def", "assert_location_source_type", "(", "hass", ",", "source_type", ")", ":", "state", "=", "hass", ".", "states", ".", "get", "(", "DEVICE_TRACKER_STATE", ")", "assert", "state", ".", "attributes", ".", "get", "(", "\"source_type\"", ")", "==", "source_typ...
[ 378, 0 ]
[ 381, 61 ]
python
en
['en', 'en', 'en']
True
assert_mobile_tracker_state
(hass, location, beacon=IBEACON_DEVICE)
Test the assertion of a mobile beacon tracker state.
Test the assertion of a mobile beacon tracker state.
def assert_mobile_tracker_state(hass, location, beacon=IBEACON_DEVICE): """Test the assertion of a mobile beacon tracker state.""" dev_id = MOBILE_BEACON_FMT.format(beacon) state = hass.states.get(dev_id) assert state.state == location
[ "def", "assert_mobile_tracker_state", "(", "hass", ",", "location", ",", "beacon", "=", "IBEACON_DEVICE", ")", ":", "dev_id", "=", "MOBILE_BEACON_FMT", ".", "format", "(", "beacon", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "dev_id", ")", ...
[ 384, 0 ]
[ 388, 34 ]
python
en
['en', 'en', 'en']
True
assert_mobile_tracker_latitude
(hass, latitude, beacon=IBEACON_DEVICE)
Test the assertion of a mobile beacon tracker latitude.
Test the assertion of a mobile beacon tracker latitude.
def assert_mobile_tracker_latitude(hass, latitude, beacon=IBEACON_DEVICE): """Test the assertion of a mobile beacon tracker latitude.""" dev_id = MOBILE_BEACON_FMT.format(beacon) state = hass.states.get(dev_id) assert state.attributes.get("latitude") == latitude
[ "def", "assert_mobile_tracker_latitude", "(", "hass", ",", "latitude", ",", "beacon", "=", "IBEACON_DEVICE", ")", ":", "dev_id", "=", "MOBILE_BEACON_FMT", ".", "format", "(", "beacon", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "dev_id", ")",...
[ 391, 0 ]
[ 395, 55 ]
python
en
['en', 'en', 'en']
True
assert_mobile_tracker_accuracy
(hass, accuracy, beacon=IBEACON_DEVICE)
Test the assertion of a mobile beacon tracker accuracy.
Test the assertion of a mobile beacon tracker accuracy.
def assert_mobile_tracker_accuracy(hass, accuracy, beacon=IBEACON_DEVICE): """Test the assertion of a mobile beacon tracker accuracy.""" dev_id = MOBILE_BEACON_FMT.format(beacon) state = hass.states.get(dev_id) assert state.attributes.get("gps_accuracy") == accuracy
[ "def", "assert_mobile_tracker_accuracy", "(", "hass", ",", "accuracy", ",", "beacon", "=", "IBEACON_DEVICE", ")", ":", "dev_id", "=", "MOBILE_BEACON_FMT", ".", "format", "(", "beacon", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "dev_id", ")",...
[ 398, 0 ]
[ 402, 59 ]
python
en
['en', 'en', 'en']
True
test_location_invalid_devid
(hass, context)
Test the update of a location.
Test the update of a location.
async def test_location_invalid_devid(hass, context): """Test the update of a location.""" await send_message(hass, "owntracks/paulus/nexus-5x", LOCATION_MESSAGE) state = hass.states.get("device_tracker.paulus_nexus_5x") assert state.state == "outer"
[ "async", "def", "test_location_invalid_devid", "(", "hass", ",", "context", ")", ":", "await", "send_message", "(", "hass", ",", "\"owntracks/paulus/nexus-5x\"", ",", "LOCATION_MESSAGE", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "\"device_tracker....
[ 405, 0 ]
[ 409, 33 ]
python
en
['en', 'en', 'en']
True
test_location_update
(hass, context)
Test the update of a location.
Test the update of a location.
async def test_location_update(hass, context): """Test the update of a location.""" await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) assert_location_source_type(hass, "gps") assert_location_latitude(hass, LOCATION_MESSAGE["lat"]) assert_location_accuracy(hass, LOCATION_MESSAGE["acc"]) ...
[ "async", "def", "test_location_update", "(", "hass", ",", "context", ")", ":", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "assert_location_source_type", "(", "hass", ",", "\"gps\"", ")", "assert_location_latitude", "("...
[ 412, 0 ]
[ 419, 40 ]
python
en
['en', 'en', 'en']
True
test_location_update_no_t_key
(hass, context)
Test the update of a location when message does not contain 't'.
Test the update of a location when message does not contain 't'.
async def test_location_update_no_t_key(hass, context): """Test the update of a location when message does not contain 't'.""" message = LOCATION_MESSAGE.copy() message.pop("t") await send_message(hass, LOCATION_TOPIC, message) assert_location_source_type(hass, "gps") assert_location_latitude(h...
[ "async", "def", "test_location_update_no_t_key", "(", "hass", ",", "context", ")", ":", "message", "=", "LOCATION_MESSAGE", ".", "copy", "(", ")", "message", ".", "pop", "(", "\"t\"", ")", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "me...
[ 422, 0 ]
[ 431, 40 ]
python
en
['en', 'en', 'en']
True
test_location_inaccurate_gps
(hass, context)
Test the location for inaccurate GPS information.
Test the location for inaccurate GPS information.
async def test_location_inaccurate_gps(hass, context): """Test the location for inaccurate GPS information.""" await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE_INACCURATE) # Ignored inaccurate GPS. Location remains at previous. ass...
[ "async", "def", "test_location_inaccurate_gps", "(", "hass", ",", "context", ")", ":", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE_INAC...
[ 434, 0 ]
[ 441, 60 ]
python
en
['en', 'en', 'en']
True
test_location_zero_accuracy_gps
(hass, context)
Ignore the location for zero accuracy GPS information.
Ignore the location for zero accuracy GPS information.
async def test_location_zero_accuracy_gps(hass, context): """Ignore the location for zero accuracy GPS information.""" await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE_ZERO_ACCURACY) # Ignored inaccurate GPS. Location remains at previo...
[ "async", "def", "test_location_zero_accuracy_gps", "(", "hass", ",", "context", ")", ":", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE_Z...
[ 444, 0 ]
[ 451, 60 ]
python
en
['en', 'en', 'en']
True
test_event_gps_entry_exit
(hass, context)
Test the entry event.
Test the entry event.
async def test_event_gps_entry_exit(hass, context): """Test the entry event.""" # Entering the owntracks circular region named "inner" await send_message(hass, EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE) # Enter uses the zone's gps co-ords assert_location_latitude(hass, INNER_ZONE["latitude"]) asser...
[ "async", "def", "test_event_gps_entry_exit", "(", "hass", ",", "context", ")", ":", "# Entering the owntracks circular region named \"inner\"", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "REGION_GPS_ENTER_MESSAGE", ")", "# Enter uses the zone's gps co-ords",...
[ 456, 0 ]
[ 491, 59 ]
python
en
['en', 'en', 'en']
True
test_event_gps_with_spaces
(hass, context)
Test the entry event.
Test the entry event.
async def test_event_gps_with_spaces(hass, context): """Test the entry event.""" message = build_message({"desc": "inner 2"}, REGION_GPS_ENTER_MESSAGE) await send_message(hass, EVENT_TOPIC, message) assert_location_state(hass, "inner 2") message = build_message({"desc": "inner 2"}, REGION_GPS_LEAVE...
[ "async", "def", "test_event_gps_with_spaces", "(", "hass", ",", "context", ")", ":", "message", "=", "build_message", "(", "{", "\"desc\"", ":", "\"inner 2\"", "}", ",", "REGION_GPS_ENTER_MESSAGE", ")", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", "...
[ 494, 0 ]
[ 504, 46 ]
python
en
['en', 'en', 'en']
True
test_event_gps_entry_inaccurate
(hass, context)
Test the event for inaccurate entry.
Test the event for inaccurate entry.
async def test_event_gps_entry_inaccurate(hass, context): """Test the event for inaccurate entry.""" # Set location to the outer zone. await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) await send_message(hass, EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE_INACCURATE) # I enter the zone even thoug...
[ "async", "def", "test_event_gps_entry_inaccurate", "(", "hass", ",", "context", ")", ":", "# Set location to the outer zone.", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "await", "send_message", "(", "hass", ",", "EVENT_...
[ 507, 0 ]
[ 517, 40 ]
python
en
['en', 'en', 'en']
True
test_event_gps_entry_exit_inaccurate
(hass, context)
Test the event for inaccurate exit.
Test the event for inaccurate exit.
async def test_event_gps_entry_exit_inaccurate(hass, context): """Test the event for inaccurate exit.""" await send_message(hass, EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE) # Enter uses the zone's gps co-ords assert_location_latitude(hass, INNER_ZONE["latitude"]) assert_location_accuracy(hass, INNER_ZO...
[ "async", "def", "test_event_gps_entry_exit_inaccurate", "(", "hass", ",", "context", ")", ":", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "REGION_GPS_ENTER_MESSAGE", ")", "# Enter uses the zone's gps co-ords", "assert_location_latitude", "(", "hass", "...
[ 520, 0 ]
[ 537, 46 ]
python
en
['en', 'en', 'en']
True
test_event_gps_entry_exit_zero_accuracy
(hass, context)
Test entry/exit events with accuracy zero.
Test entry/exit events with accuracy zero.
async def test_event_gps_entry_exit_zero_accuracy(hass, context): """Test entry/exit events with accuracy zero.""" await send_message(hass, EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE_ZERO) # Enter uses the zone's gps co-ords assert_location_latitude(hass, INNER_ZONE["latitude"]) assert_location_accuracy...
[ "async", "def", "test_event_gps_entry_exit_zero_accuracy", "(", "hass", ",", "context", ")", ":", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "REGION_GPS_ENTER_MESSAGE_ZERO", ")", "# Enter uses the zone's gps co-ords", "assert_location_latitude", "(", "ha...
[ 540, 0 ]
[ 557, 46 ]
python
en
['en', 'en', 'en']
True
test_event_gps_exit_outside_zone_sets_away
(hass, context)
Test the event for exit zone.
Test the event for exit zone.
async def test_event_gps_exit_outside_zone_sets_away(hass, context): """Test the event for exit zone.""" await send_message(hass, EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE) assert_location_state(hass, "inner") # Exit message far away GPS location message = build_message({"lon": 90.0, "lat": 90.0}, REGI...
[ "async", "def", "test_event_gps_exit_outside_zone_sets_away", "(", "hass", ",", "context", ")", ":", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "REGION_GPS_ENTER_MESSAGE", ")", "assert_location_state", "(", "hass", ",", "\"inner\"", ")", "# Exit me...
[ 560, 0 ]
[ 570, 47 ]
python
en
['en', 'en', 'en']
True
test_event_gps_entry_exit_right_order
(hass, context)
Test the event for ordering.
Test the event for ordering.
async def test_event_gps_entry_exit_right_order(hass, context): """Test the event for ordering.""" # Enter inner zone # Set location to the outer zone. await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) await send_message(hass, EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE) assert_location_state...
[ "async", "def", "test_event_gps_entry_exit_right_order", "(", "hass", ",", "context", ")", ":", "# Enter inner zone", "# Set location to the outer zone.", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "await", "send_message", "...
[ 573, 0 ]
[ 595, 40 ]
python
en
['en', 'en', 'en']
True
test_event_gps_entry_exit_wrong_order
(hass, context)
Test the event for wrong order.
Test the event for wrong order.
async def test_event_gps_entry_exit_wrong_order(hass, context): """Test the event for wrong order.""" # Enter inner zone await send_message(hass, EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE) assert_location_state(hass, "inner") # Enter inner2 zone message = build_message({"desc": "inner_2"}, REGION_G...
[ "async", "def", "test_event_gps_entry_exit_wrong_order", "(", "hass", ",", "context", ")", ":", "# Enter inner zone", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "REGION_GPS_ENTER_MESSAGE", ")", "assert_location_state", "(", "hass", ",", "\"inner\"", ...
[ 598, 0 ]
[ 618, 40 ]
python
en
['en', 'en', 'en']
True
test_event_gps_entry_unknown_zone
(hass, context)
Test the event for unknown zone.
Test the event for unknown zone.
async def test_event_gps_entry_unknown_zone(hass, context): """Test the event for unknown zone.""" # Just treat as location update message = build_message({"desc": "unknown"}, REGION_GPS_ENTER_MESSAGE) await send_message(hass, EVENT_TOPIC, message) assert_location_latitude(hass, REGION_GPS_ENTER_MES...
[ "async", "def", "test_event_gps_entry_unknown_zone", "(", "hass", ",", "context", ")", ":", "# Just treat as location update", "message", "=", "build_message", "(", "{", "\"desc\"", ":", "\"unknown\"", "}", ",", "REGION_GPS_ENTER_MESSAGE", ")", "await", "send_message", ...
[ 621, 0 ]
[ 627, 40 ]
python
en
['en', 'en', 'en']
True
test_event_gps_exit_unknown_zone
(hass, context)
Test the event for unknown zone.
Test the event for unknown zone.
async def test_event_gps_exit_unknown_zone(hass, context): """Test the event for unknown zone.""" # Just treat as location update message = build_message({"desc": "unknown"}, REGION_GPS_LEAVE_MESSAGE) await send_message(hass, EVENT_TOPIC, message) assert_location_latitude(hass, REGION_GPS_LEAVE_MESS...
[ "async", "def", "test_event_gps_exit_unknown_zone", "(", "hass", ",", "context", ")", ":", "# Just treat as location update", "message", "=", "build_message", "(", "{", "\"desc\"", ":", "\"unknown\"", "}", ",", "REGION_GPS_LEAVE_MESSAGE", ")", "await", "send_message", ...
[ 630, 0 ]
[ 636, 40 ]
python
en
['en', 'en', 'en']
True
test_event_entry_zone_loading_dash
(hass, context)
Test the event for zone landing.
Test the event for zone landing.
async def test_event_entry_zone_loading_dash(hass, context): """Test the event for zone landing.""" # Make sure the leading - is ignored # Owntracks uses this to switch on hold message = build_message({"desc": "-inner"}, REGION_GPS_ENTER_MESSAGE) await send_message(hass, EVENT_TOPIC, message) as...
[ "async", "def", "test_event_entry_zone_loading_dash", "(", "hass", ",", "context", ")", ":", "# Make sure the leading - is ignored", "# Owntracks uses this to switch on hold", "message", "=", "build_message", "(", "{", "\"desc\"", ":", "\"-inner\"", "}", ",", "REGION_GPS_EN...
[ 639, 0 ]
[ 645, 40 ]
python
en
['en', 'en', 'en']
True
test_events_only_on
(hass, context)
Test events_only config suppresses location updates.
Test events_only config suppresses location updates.
async def test_events_only_on(hass, context): """Test events_only config suppresses location updates.""" # Sending a location message that is not home await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE_NOT_HOME) assert_location_state(hass, STATE_NOT_HOME) context().events_only = True # ...
[ "async", "def", "test_events_only_on", "(", "hass", ",", "context", ")", ":", "# Sending a location message that is not home", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE_NOT_HOME", ")", "assert_location_state", "(", "hass", ",", ...
[ 648, 0 ]
[ 666, 47 ]
python
en
['en', 'en', 'en']
True
test_events_only_off
(hass, context)
Test when events_only is False.
Test when events_only is False.
async def test_events_only_off(hass, context): """Test when events_only is False.""" # Sending a location message that is not home await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE_NOT_HOME) assert_location_state(hass, STATE_NOT_HOME) context().events_only = False # Enter and Leave mes...
[ "async", "def", "test_events_only_off", "(", "hass", ",", "context", ")", ":", "# Sending a location message that is not home", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE_NOT_HOME", ")", "assert_location_state", "(", "hass", ",", ...
[ 669, 0 ]
[ 687, 40 ]
python
en
['en', 'en', 'en']
True
test_event_source_type_entry_exit
(hass, context)
Test the entry and exit events of source type.
Test the entry and exit events of source type.
async def test_event_source_type_entry_exit(hass, context): """Test the entry and exit events of source type.""" # Entering the owntracks circular region named "inner" await send_message(hass, EVENT_TOPIC, REGION_GPS_ENTER_MESSAGE) # source_type should be gps when entering using gps. assert_locatio...
[ "async", "def", "test_event_source_type_entry_exit", "(", "hass", ",", "context", ")", ":", "# Entering the owntracks circular region named \"inner\"", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "REGION_GPS_ENTER_MESSAGE", ")", "# source_type should be gps w...
[ 690, 0 ]
[ 716, 53 ]
python
en
['en', 'en', 'en']
True
test_event_region_entry_exit
(hass, context)
Test the entry event.
Test the entry event.
async def test_event_region_entry_exit(hass, context): """Test the entry event.""" # Seeing a beacon named "inner" await send_message(hass, EVENT_TOPIC, REGION_BEACON_ENTER_MESSAGE) # Enter uses the zone's gps co-ords assert_location_latitude(hass, INNER_ZONE["latitude"]) assert_location_accura...
[ "async", "def", "test_event_region_entry_exit", "(", "hass", ",", "context", ")", ":", "# Seeing a beacon named \"inner\"", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "REGION_BEACON_ENTER_MESSAGE", ")", "# Enter uses the zone's gps co-ords", "assert_locati...
[ 720, 0 ]
[ 756, 59 ]
python
en
['en', 'en', 'en']
True
test_event_region_with_spaces
(hass, context)
Test the entry event.
Test the entry event.
async def test_event_region_with_spaces(hass, context): """Test the entry event.""" message = build_message({"desc": "inner 2"}, REGION_BEACON_ENTER_MESSAGE) await send_message(hass, EVENT_TOPIC, message) assert_location_state(hass, "inner 2") message = build_message({"desc": "inner 2"}, REGION_BEA...
[ "async", "def", "test_event_region_with_spaces", "(", "hass", ",", "context", ")", ":", "message", "=", "build_message", "(", "{", "\"desc\"", ":", "\"inner 2\"", "}", ",", "REGION_BEACON_ENTER_MESSAGE", ")", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC...
[ 759, 0 ]
[ 769, 46 ]
python
en
['en', 'en', 'en']
True
test_event_region_entry_exit_right_order
(hass, context)
Test the event for ordering.
Test the event for ordering.
async def test_event_region_entry_exit_right_order(hass, context): """Test the event for ordering.""" # Enter inner zone # Set location to the outer zone. await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) # See 'inner' region beacon await send_message(hass, EVENT_TOPIC, REGION_BEACON_E...
[ "async", "def", "test_event_region_entry_exit_right_order", "(", "hass", ",", "context", ")", ":", "# Enter inner zone", "# Set location to the outer zone.", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "# See 'inner' region beaco...
[ 772, 0 ]
[ 800, 40 ]
python
en
['en', 'en', 'en']
True
test_event_region_entry_exit_wrong_order
(hass, context)
Test the event for wrong order.
Test the event for wrong order.
async def test_event_region_entry_exit_wrong_order(hass, context): """Test the event for wrong order.""" # Enter inner zone await send_message(hass, EVENT_TOPIC, REGION_BEACON_ENTER_MESSAGE) assert_location_state(hass, "inner") # Enter inner2 zone message = build_message({"desc": "inner_2"}, RE...
[ "async", "def", "test_event_region_entry_exit_wrong_order", "(", "hass", ",", "context", ")", ":", "# Enter inner zone", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "REGION_BEACON_ENTER_MESSAGE", ")", "assert_location_state", "(", "hass", ",", "\"inne...
[ 803, 0 ]
[ 827, 42 ]
python
en
['en', 'en', 'en']
True
test_event_beacon_unknown_zone_no_location
(hass, context)
Test the event for unknown zone.
Test the event for unknown zone.
async def test_event_beacon_unknown_zone_no_location(hass, context): """Test the event for unknown zone.""" # A beacon which does not match a HA zone is the # definition of a mobile beacon. In this case, "unknown" # will be turned into device_tracker.beacon_unknown and # that will be tracked at my c...
[ "async", "def", "test_event_beacon_unknown_zone_no_location", "(", "hass", ",", "context", ")", ":", "# A beacon which does not match a HA zone is the", "# definition of a mobile beacon. In this case, \"unknown\"", "# will be turned into device_tracker.beacon_unknown and", "# that will be tr...
[ 830, 0 ]
[ 852, 59 ]
python
en
['en', 'en', 'en']
True
test_event_beacon_unknown_zone
(hass, context)
Test the event for unknown zone.
Test the event for unknown zone.
async def test_event_beacon_unknown_zone(hass, context): """Test the event for unknown zone.""" # A beacon which does not match a HA zone is the # definition of a mobile beacon. In this case, "unknown" # will be turned into device_tracker.beacon_unknown and # that will be tracked at my current locat...
[ "async", "def", "test_event_beacon_unknown_zone", "(", "hass", ",", "context", ")", ":", "# A beacon which does not match a HA zone is the", "# definition of a mobile beacon. In this case, \"unknown\"", "# will be turned into device_tracker.beacon_unknown and", "# that will be tracked at my ...
[ 855, 0 ]
[ 872, 57 ]
python
en
['en', 'en', 'en']
True
test_event_beacon_entry_zone_loading_dash
(hass, context)
Test the event for beacon zone landing.
Test the event for beacon zone landing.
async def test_event_beacon_entry_zone_loading_dash(hass, context): """Test the event for beacon zone landing.""" # Make sure the leading - is ignored # Owntracks uses this to switch on hold message = build_message({"desc": "-inner"}, REGION_BEACON_ENTER_MESSAGE) await send_message(hass, EVENT_TOPI...
[ "async", "def", "test_event_beacon_entry_zone_loading_dash", "(", "hass", ",", "context", ")", ":", "# Make sure the leading - is ignored", "# Owntracks uses this to switch on hold", "message", "=", "build_message", "(", "{", "\"desc\"", ":", "\"-inner\"", "}", ",", "REGION...
[ 875, 0 ]
[ 882, 40 ]
python
en
['en', 'en', 'en']
True
test_mobile_enter_move_beacon
(hass, context)
Test the movement of a beacon.
Test the movement of a beacon.
async def test_mobile_enter_move_beacon(hass, context): """Test the movement of a beacon.""" # I am in the outer zone. await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) # I see the 'keys' beacon. I set the location of the # beacon_keys tracker to my current device location. await send_...
[ "async", "def", "test_mobile_enter_move_beacon", "(", "hass", ",", "context", ")", ":", "# I am in the outer zone.", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "# I see the 'keys' beacon. I set the location of the", "# beacon_ke...
[ 887, 0 ]
[ 908, 54 ]
python
en
['en', 'en', 'en']
True
test_mobile_enter_exit_region_beacon
(hass, context)
Test the enter and the exit of a mobile beacon.
Test the enter and the exit of a mobile beacon.
async def test_mobile_enter_exit_region_beacon(hass, context): """Test the enter and the exit of a mobile beacon.""" # I am in the outer zone. await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) # I see a new mobile beacon await send_message(hass, EVENT_TOPIC, MOBILE_BEACON_ENTER_EVENT_MESSA...
[ "async", "def", "test_mobile_enter_exit_region_beacon", "(", "hass", ",", "context", ")", ":", "# I am in the outer zone.", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "# I see a new mobile beacon", "await", "send_message", "...
[ 911, 0 ]
[ 931, 46 ]
python
en
['en', 'en', 'en']
True
test_mobile_exit_move_beacon
(hass, context)
Test the exit move of a beacon.
Test the exit move of a beacon.
async def test_mobile_exit_move_beacon(hass, context): """Test the exit move of a beacon.""" # I am in the outer zone. await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) # I see a new mobile beacon await send_message(hass, EVENT_TOPIC, MOBILE_BEACON_ENTER_EVENT_MESSAGE) assert_mobile_tr...
[ "async", "def", "test_mobile_exit_move_beacon", "(", "hass", ",", "context", ")", ":", "# I am in the outer zone.", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "# I see a new mobile beacon", "await", "send_message", "(", "h...
[ 934, 0 ]
[ 953, 46 ]
python
en
['en', 'en', 'en']
True
test_mobile_multiple_async_enter_exit
(hass, context)
Test the multiple entering.
Test the multiple entering.
async def test_mobile_multiple_async_enter_exit(hass, context): """Test the multiple entering.""" # Test race condition for _ in range(0, 20): async_fire_mqtt_message( hass, EVENT_TOPIC, json.dumps(MOBILE_BEACON_ENTER_EVENT_MESSAGE) ) async_fire_mqtt_message( ...
[ "async", "def", "test_mobile_multiple_async_enter_exit", "(", "hass", ",", "context", ")", ":", "# Test race condition", "for", "_", "in", "range", "(", "0", ",", "20", ")", ":", "async_fire_mqtt_message", "(", "hass", ",", "EVENT_TOPIC", ",", "json", ".", "du...
[ 956, 0 ]
[ 973, 66 ]
python
en
['en', 'en', 'en']
True
test_mobile_multiple_enter_exit
(hass, context)
Test the multiple entering.
Test the multiple entering.
async def test_mobile_multiple_enter_exit(hass, context): """Test the multiple entering.""" await send_message(hass, EVENT_TOPIC, MOBILE_BEACON_ENTER_EVENT_MESSAGE) await send_message(hass, EVENT_TOPIC, MOBILE_BEACON_ENTER_EVENT_MESSAGE) await send_message(hass, EVENT_TOPIC, MOBILE_BEACON_LEAVE_EVENT_ME...
[ "async", "def", "test_mobile_multiple_enter_exit", "(", "hass", ",", "context", ")", ":", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "MOBILE_BEACON_ENTER_EVENT_MESSAGE", ")", "await", "send_message", "(", "hass", ",", "EVENT_TOPIC", ",", "MOBILE_...
[ 976, 0 ]
[ 982, 66 ]
python
en
['en', 'en', 'en']
True
test_complex_movement
(hass, context)
Test a complex sequence representative of real-world use.
Test a complex sequence representative of real-world use.
async def test_complex_movement(hass, context): """Test a complex sequence representative of real-world use.""" # I am in the outer zone. await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) assert_location_state(hass, "outer") # gps to inner location and event, as actually happens with OwnTr...
[ "async", "def", "test_complex_movement", "(", "hass", ",", "context", ")", ":", "# I am in the outer zone.", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "assert_location_state", "(", "hass", ",", "\"outer\"", ")", "# gp...
[ 985, 0 ]
[ 1104, 46 ]
python
en
['en', 'en', 'en']
True
test_complex_movement_sticky_keys_beacon
(hass, context)
Test a complex sequence which was previously broken.
Test a complex sequence which was previously broken.
async def test_complex_movement_sticky_keys_beacon(hass, context): """Test a complex sequence which was previously broken.""" # I am not_home await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE) assert_location_state(hass, "outer") # gps to inner location and event, as actually happens with O...
[ "async", "def", "test_complex_movement_sticky_keys_beacon", "(", "hass", ",", "context", ")", ":", "# I am not_home", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "LOCATION_MESSAGE", ")", "assert_location_state", "(", "hass", ",", "\"outer\"", ")"...
[ 1107, 0 ]
[ 1216, 64 ]
python
en
['en', 'en', 'en']
True
test_waypoint_import_simple
(hass, context)
Test a simple import of list of waypoints.
Test a simple import of list of waypoints.
async def test_waypoint_import_simple(hass, context): """Test a simple import of list of waypoints.""" waypoints_message = WAYPOINTS_EXPORTED_MESSAGE.copy() await send_message(hass, WAYPOINTS_TOPIC, waypoints_message) # Check if it made it into states wayp = hass.states.get(WAYPOINT_ENTITY_NAMES[0])...
[ "async", "def", "test_waypoint_import_simple", "(", "hass", ",", "context", ")", ":", "waypoints_message", "=", "WAYPOINTS_EXPORTED_MESSAGE", ".", "copy", "(", ")", "await", "send_message", "(", "hass", ",", "WAYPOINTS_TOPIC", ",", "waypoints_message", ")", "# Check...
[ 1219, 0 ]
[ 1227, 27 ]
python
en
['en', 'en', 'en']
True
test_waypoint_import_block
(hass, context)
Test import of list of waypoints for blocked user.
Test import of list of waypoints for blocked user.
async def test_waypoint_import_block(hass, context): """Test import of list of waypoints for blocked user.""" waypoints_message = WAYPOINTS_EXPORTED_MESSAGE.copy() await send_message(hass, WAYPOINTS_TOPIC_BLOCKED, waypoints_message) # Check if it made it into states wayp = hass.states.get(WAYPOINT_E...
[ "async", "def", "test_waypoint_import_block", "(", "hass", ",", "context", ")", ":", "waypoints_message", "=", "WAYPOINTS_EXPORTED_MESSAGE", ".", "copy", "(", ")", "await", "send_message", "(", "hass", ",", "WAYPOINTS_TOPIC_BLOCKED", ",", "waypoints_message", ")", "...
[ 1230, 0 ]
[ 1238, 23 ]
python
en
['en', 'en', 'en']
True
test_waypoint_import_no_whitelist
(hass, setup_comp)
Test import of list of waypoints with no whitelist set.
Test import of list of waypoints with no whitelist set.
async def test_waypoint_import_no_whitelist(hass, setup_comp): """Test import of list of waypoints with no whitelist set.""" await setup_owntracks( hass, { CONF_MAX_GPS_ACCURACY: 200, CONF_WAYPOINT_IMPORT: True, CONF_MQTT_TOPIC: "owntracks/#", }, )...
[ "async", "def", "test_waypoint_import_no_whitelist", "(", "hass", ",", "setup_comp", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_MAX_GPS_ACCURACY", ":", "200", ",", "CONF_WAYPOINT_IMPORT", ":", "True", ",", "CONF_MQTT_TOPIC", ":", "\"owntracks...
[ 1241, 0 ]
[ 1258, 27 ]
python
en
['en', 'en', 'en']
True
test_waypoint_import_bad_json
(hass, context)
Test importing a bad JSON payload.
Test importing a bad JSON payload.
async def test_waypoint_import_bad_json(hass, context): """Test importing a bad JSON payload.""" waypoints_message = WAYPOINTS_EXPORTED_MESSAGE.copy() await send_message(hass, WAYPOINTS_TOPIC, waypoints_message, True) # Check if it made it into states wayp = hass.states.get(WAYPOINT_ENTITY_NAMES[2])...
[ "async", "def", "test_waypoint_import_bad_json", "(", "hass", ",", "context", ")", ":", "waypoints_message", "=", "WAYPOINTS_EXPORTED_MESSAGE", ".", "copy", "(", ")", "await", "send_message", "(", "hass", ",", "WAYPOINTS_TOPIC", ",", "waypoints_message", ",", "True"...
[ 1261, 0 ]
[ 1269, 23 ]
python
en
['en', 'en', 'en']
True
test_waypoint_import_existing
(hass, context)
Test importing a zone that exists.
Test importing a zone that exists.
async def test_waypoint_import_existing(hass, context): """Test importing a zone that exists.""" waypoints_message = WAYPOINTS_EXPORTED_MESSAGE.copy() await send_message(hass, WAYPOINTS_TOPIC, waypoints_message) # Get the first waypoint exported wayp = hass.states.get(WAYPOINT_ENTITY_NAMES[0]) #...
[ "async", "def", "test_waypoint_import_existing", "(", "hass", ",", "context", ")", ":", "waypoints_message", "=", "WAYPOINTS_EXPORTED_MESSAGE", ".", "copy", "(", ")", "await", "send_message", "(", "hass", ",", "WAYPOINTS_TOPIC", ",", "waypoints_message", ")", "# Get...
[ 1272, 0 ]
[ 1282, 27 ]
python
en
['en', 'en', 'en']
True
test_single_waypoint_import
(hass, context)
Test single waypoint message.
Test single waypoint message.
async def test_single_waypoint_import(hass, context): """Test single waypoint message.""" waypoint_message = WAYPOINT_MESSAGE.copy() await send_message(hass, WAYPOINT_TOPIC, waypoint_message) wayp = hass.states.get(WAYPOINT_ENTITY_NAMES[0]) assert wayp is not None
[ "async", "def", "test_single_waypoint_import", "(", "hass", ",", "context", ")", ":", "waypoint_message", "=", "WAYPOINT_MESSAGE", ".", "copy", "(", ")", "await", "send_message", "(", "hass", ",", "WAYPOINT_TOPIC", ",", "waypoint_message", ")", "wayp", "=", "has...
[ 1285, 0 ]
[ 1290, 27 ]
python
en
['en', 'fi', 'en']
True
test_not_implemented_message
(hass, context)
Handle not implemented message type.
Handle not implemented message type.
async def test_not_implemented_message(hass, context): """Handle not implemented message type.""" patch_handler = patch( "homeassistant.components.owntracks.messages.async_handle_not_impl_msg", return_value=mock_coro(False), ) patch_handler.start() assert not await send_message(hass,...
[ "async", "def", "test_not_implemented_message", "(", "hass", ",", "context", ")", ":", "patch_handler", "=", "patch", "(", "\"homeassistant.components.owntracks.messages.async_handle_not_impl_msg\"", ",", "return_value", "=", "mock_coro", "(", "False", ")", ",", ")", "p...
[ 1293, 0 ]
[ 1301, 24 ]
python
en
['en', 'en', 'en']
True
test_unsupported_message
(hass, context)
Handle not implemented message type.
Handle not implemented message type.
async def test_unsupported_message(hass, context): """Handle not implemented message type.""" patch_handler = patch( "homeassistant.components.owntracks.messages.async_handle_unsupported_msg", return_value=mock_coro(False), ) patch_handler.start() assert not await send_message(hass, ...
[ "async", "def", "test_unsupported_message", "(", "hass", ",", "context", ")", ":", "patch_handler", "=", "patch", "(", "\"homeassistant.components.owntracks.messages.async_handle_unsupported_msg\"", ",", "return_value", "=", "mock_coro", "(", "False", ")", ",", ")", "pa...
[ 1304, 0 ]
[ 1312, 24 ]
python
en
['en', 'en', 'en']
True
generate_ciphers
(secret)
Generate test ciphers for the DEFAULT_LOCATION_MESSAGE.
Generate test ciphers for the DEFAULT_LOCATION_MESSAGE.
def generate_ciphers(secret): """Generate test ciphers for the DEFAULT_LOCATION_MESSAGE.""" # PyNaCl ciphertext generation will fail if the module # cannot be imported. However, the test for decryption # also relies on this library and won't be run without it. import base64 import pickle tr...
[ "def", "generate_ciphers", "(", "secret", ")", ":", "# PyNaCl ciphertext generation will fail if the module", "# cannot be imported. However, the test for decryption", "# also relies on this library and won't be run without it.", "import", "base64", "import", "pickle", "try", ":", "fro...
[ 1315, 0 ]
[ 1346, 22 ]
python
en
['en', 'en', 'en']
True
mock_cipher
()
Return a dummy pickle-based cipher.
Return a dummy pickle-based cipher.
def mock_cipher(): """Return a dummy pickle-based cipher.""" def mock_decrypt(ciphertext, key): """Decrypt/unpickle.""" import base64 import pickle (mkey, plaintext) = pickle.loads(base64.b64decode(ciphertext)) if key != mkey: raise ValueError() retu...
[ "def", "mock_cipher", "(", ")", ":", "def", "mock_decrypt", "(", "ciphertext", ",", "key", ")", ":", "\"\"\"Decrypt/unpickle.\"\"\"", "import", "base64", "import", "pickle", "(", "mkey", ",", "plaintext", ")", "=", "pickle", ".", "loads", "(", "base64", ".",...
[ 1366, 0 ]
[ 1379, 45 ]
python
en
['en', 'da', 'en']
True
config_context
(hass, setup_comp)
Set up the mocked context.
Set up the mocked context.
def config_context(hass, setup_comp): """Set up the mocked context.""" patch_load = patch( "homeassistant.components.device_tracker.async_load_config", return_value=mock_coro([]), ) patch_load.start() patch_save = patch( "homeassistant.components.device_tracker.DeviceTracker...
[ "def", "config_context", "(", "hass", ",", "setup_comp", ")", ":", "patch_load", "=", "patch", "(", "\"homeassistant.components.device_tracker.async_load_config\"", ",", "return_value", "=", "mock_coro", "(", "[", "]", ")", ",", ")", "patch_load", ".", "start", "(...
[ 1383, 0 ]
[ 1399, 21 ]
python
en
['en', 'en', 'en']
True
mock_not_supports_encryption
()
Mock non successful nacl import.
Mock non successful nacl import.
def mock_not_supports_encryption(): """Mock non successful nacl import.""" with patch( "homeassistant.components.owntracks.messages.supports_encryption", return_value=False, ): yield
[ "def", "mock_not_supports_encryption", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.owntracks.messages.supports_encryption\"", ",", "return_value", "=", "False", ",", ")", ":", "yield" ]
[ 1403, 0 ]
[ 1409, 13 ]
python
de
['de', 'it', 'en']
False
mock_get_cipher_error
()
Mock non successful cipher.
Mock non successful cipher.
def mock_get_cipher_error(): """Mock non successful cipher.""" with patch( "homeassistant.components.owntracks.messages.get_cipher", side_effect=OSError() ): yield
[ "def", "mock_get_cipher_error", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.owntracks.messages.get_cipher\"", ",", "side_effect", "=", "OSError", "(", ")", ")", ":", "yield" ]
[ 1413, 0 ]
[ 1418, 13 ]
python
en
['it', 'ro', 'en']
False
test_encrypted_payload
(hass, setup_comp)
Test encrypted payload.
Test encrypted payload.
async def test_encrypted_payload(hass, setup_comp): """Test encrypted payload.""" await setup_owntracks(hass, {CONF_SECRET: TEST_SECRET_KEY}) await send_message(hass, LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE) assert_location_latitude(hass, LOCATION_MESSAGE["lat"])
[ "async", "def", "test_encrypted_payload", "(", "hass", ",", "setup_comp", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_SECRET", ":", "TEST_SECRET_KEY", "}", ")", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "MOCK_ENCRYP...
[ 1422, 0 ]
[ 1426, 59 ]
python
en
['fr', 'en', 'en']
True
test_encrypted_payload_topic_key
(hass, setup_comp)
Test encrypted payload with a topic key.
Test encrypted payload with a topic key.
async def test_encrypted_payload_topic_key(hass, setup_comp): """Test encrypted payload with a topic key.""" await setup_owntracks(hass, {CONF_SECRET: {LOCATION_TOPIC: TEST_SECRET_KEY}}) await send_message(hass, LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE) assert_location_latitude(hass, LOCATION_MES...
[ "async", "def", "test_encrypted_payload_topic_key", "(", "hass", ",", "setup_comp", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_SECRET", ":", "{", "LOCATION_TOPIC", ":", "TEST_SECRET_KEY", "}", "}", ")", "await", "send_message", "(", "hass...
[ 1430, 0 ]
[ 1434, 59 ]
python
en
['en', 'en', 'en']
True
test_encrypted_payload_not_supports_encryption
( hass, setup_comp, not_supports_encryption )
Test encrypted payload with no supported encryption.
Test encrypted payload with no supported encryption.
async def test_encrypted_payload_not_supports_encryption( hass, setup_comp, not_supports_encryption ): """Test encrypted payload with no supported encryption.""" await setup_owntracks(hass, {CONF_SECRET: TEST_SECRET_KEY}) await send_message(hass, LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE) asse...
[ "async", "def", "test_encrypted_payload_not_supports_encryption", "(", "hass", ",", "setup_comp", ",", "not_supports_encryption", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_SECRET", ":", "TEST_SECRET_KEY", "}", ")", "await", "send_message", "("...
[ 1437, 0 ]
[ 1443, 56 ]
python
en
['en', 'en', 'en']
True
test_encrypted_payload_get_cipher_error
(hass, setup_comp, get_cipher_error)
Test encrypted payload with no supported encryption.
Test encrypted payload with no supported encryption.
async def test_encrypted_payload_get_cipher_error(hass, setup_comp, get_cipher_error): """Test encrypted payload with no supported encryption.""" await setup_owntracks(hass, {CONF_SECRET: TEST_SECRET_KEY}) await send_message(hass, LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE) assert hass.states.get(D...
[ "async", "def", "test_encrypted_payload_get_cipher_error", "(", "hass", ",", "setup_comp", ",", "get_cipher_error", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_SECRET", ":", "TEST_SECRET_KEY", "}", ")", "await", "send_message", "(", "hass", ...
[ 1446, 0 ]
[ 1450, 56 ]
python
en
['en', 'en', 'en']
True
test_encrypted_payload_no_key
(hass, setup_comp)
Test encrypted payload with no key, .
Test encrypted payload with no key, .
async def test_encrypted_payload_no_key(hass, setup_comp): """Test encrypted payload with no key, .""" assert hass.states.get(DEVICE_TRACKER_STATE) is None await setup_owntracks(hass, {CONF_SECRET: {}}) await send_message(hass, LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE) assert hass.states.get(...
[ "async", "def", "test_encrypted_payload_no_key", "(", "hass", ",", "setup_comp", ")", ":", "assert", "hass", ".", "states", ".", "get", "(", "DEVICE_TRACKER_STATE", ")", "is", "None", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_SECRET", ":", "{", ...
[ 1454, 0 ]
[ 1459, 56 ]
python
en
['en', 'en', 'en']
True
test_encrypted_payload_wrong_key
(hass, setup_comp)
Test encrypted payload with wrong key.
Test encrypted payload with wrong key.
async def test_encrypted_payload_wrong_key(hass, setup_comp): """Test encrypted payload with wrong key.""" await setup_owntracks(hass, {CONF_SECRET: "wrong key"}) await send_message(hass, LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE) assert hass.states.get(DEVICE_TRACKER_STATE) is None
[ "async", "def", "test_encrypted_payload_wrong_key", "(", "hass", ",", "setup_comp", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_SECRET", ":", "\"wrong key\"", "}", ")", "await", "send_message", "(", "hass", ",", "LOCATION_TOPIC", ",", "MOC...
[ 1463, 0 ]
[ 1467, 56 ]
python
en
['en', 'en', 'en']
True
test_encrypted_payload_wrong_topic_key
(hass, setup_comp)
Test encrypted payload with wrong topic key.
Test encrypted payload with wrong topic key.
async def test_encrypted_payload_wrong_topic_key(hass, setup_comp): """Test encrypted payload with wrong topic key.""" await setup_owntracks(hass, {CONF_SECRET: {LOCATION_TOPIC: "wrong key"}}) await send_message(hass, LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE) assert hass.states.get(DEVICE_TRACKE...
[ "async", "def", "test_encrypted_payload_wrong_topic_key", "(", "hass", ",", "setup_comp", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_SECRET", ":", "{", "LOCATION_TOPIC", ":", "\"wrong key\"", "}", "}", ")", "await", "send_message", "(", "...
[ 1471, 0 ]
[ 1475, 56 ]
python
en
['en', 'en', 'en']
True
test_encrypted_payload_no_topic_key
(hass, setup_comp)
Test encrypted payload with no topic key.
Test encrypted payload with no topic key.
async def test_encrypted_payload_no_topic_key(hass, setup_comp): """Test encrypted payload with no topic key.""" await setup_owntracks( hass, {CONF_SECRET: {"owntracks/{}/{}".format(USER, "otherdevice"): "foobar"}} ) await send_message(hass, LOCATION_TOPIC, MOCK_ENCRYPTED_LOCATION_MESSAGE) a...
[ "async", "def", "test_encrypted_payload_no_topic_key", "(", "hass", ",", "setup_comp", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_SECRET", ":", "{", "\"owntracks/{}/{}\"", ".", "format", "(", "USER", ",", "\"otherdevice\"", ")", ":", "\"f...
[ 1479, 0 ]
[ 1485, 56 ]
python
en
['en', 'en', 'en']
True
test_encrypted_payload_libsodium
(hass, setup_comp)
Test sending encrypted message payload.
Test sending encrypted message payload.
async def test_encrypted_payload_libsodium(hass, setup_comp): """Test sending encrypted message payload.""" try: import nacl # noqa: F401 pylint: disable=unused-import except (ImportError, OSError): pytest.skip("PyNaCl/libsodium is not installed") return await setup_owntracks(h...
[ "async", "def", "test_encrypted_payload_libsodium", "(", "hass", ",", "setup_comp", ")", ":", "try", ":", "import", "nacl", "# noqa: F401 pylint: disable=unused-import", "except", "(", "ImportError", ",", "OSError", ")", ":", "pytest", ".", "skip", "(", "\"PyNaCl/li...
[ 1488, 0 ]
[ 1499, 59 ]
python
en
['en', 'en', 'en']
True
test_customized_mqtt_topic
(hass, setup_comp)
Test subscribing to a custom mqtt topic.
Test subscribing to a custom mqtt topic.
async def test_customized_mqtt_topic(hass, setup_comp): """Test subscribing to a custom mqtt topic.""" await setup_owntracks(hass, {CONF_MQTT_TOPIC: "mytracks/#"}) topic = f"mytracks/{USER}/{DEVICE}" await send_message(hass, topic, LOCATION_MESSAGE) assert_location_latitude(hass, LOCATION_MESSAGE[...
[ "async", "def", "test_customized_mqtt_topic", "(", "hass", ",", "setup_comp", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_MQTT_TOPIC", ":", "\"mytracks/#\"", "}", ")", "topic", "=", "f\"mytracks/{USER}/{DEVICE}\"", "await", "send_message", "("...
[ 1502, 0 ]
[ 1509, 59 ]
python
en
['en', 'en', 'it']
True
test_region_mapping
(hass, setup_comp)
Test region to zone mapping.
Test region to zone mapping.
async def test_region_mapping(hass, setup_comp): """Test region to zone mapping.""" await setup_owntracks(hass, {CONF_REGION_MAPPING: {"foo": "inner"}}) hass.states.async_set("zone.inner", "zoning", INNER_ZONE) message = build_message({"desc": "foo"}, REGION_GPS_ENTER_MESSAGE) assert message["desc...
[ "async", "def", "test_region_mapping", "(", "hass", ",", "setup_comp", ")", ":", "await", "setup_owntracks", "(", "hass", ",", "{", "CONF_REGION_MAPPING", ":", "{", "\"foo\"", ":", "\"inner\"", "}", "}", ")", "hass", ".", "states", ".", "async_set", "(", "...
[ 1512, 0 ]
[ 1522, 40 ]
python
en
['en', 'en', 'en']
True
test_restore_state
(hass, hass_client)
Test that we can restore state.
Test that we can restore state.
async def test_restore_state(hass, hass_client): """Test that we can restore state.""" entry = MockConfigEntry( domain="owntracks", data={"webhook_id": "owntracks_test", "secret": "abcd"} ) entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) await hass.async_bl...
[ "async", "def", "test_restore_state", "(", "hass", ",", "hass_client", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"owntracks\"", ",", "data", "=", "{", "\"webhook_id\"", ":", "\"owntracks_test\"", ",", "\"secret\"", ":", "\"abcd\"", "}", ...
[ 1525, 0 ]
[ 1560, 81 ]
python
en
['en', 'en', 'en']
True
test_returns_empty_friends
(hass, hass_client)
Test that an empty list of persons' locations is returned.
Test that an empty list of persons' locations is returned.
async def test_returns_empty_friends(hass, hass_client): """Test that an empty list of persons' locations is returned.""" entry = MockConfigEntry( domain="owntracks", data={"webhook_id": "owntracks_test", "secret": "abcd"} ) entry.add_to_hass(hass) await hass.config_entries.async_setup(entr...
[ "async", "def", "test_returns_empty_friends", "(", "hass", ",", "hass_client", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "\"owntracks\"", ",", "data", "=", "{", "\"webhook_id\"", ":", "\"owntracks_test\"", ",", "\"secret\"", ":", "\"abcd\"", ...
[ 1563, 0 ]
[ 1581, 36 ]
python
en
['en', 'en', 'en']
True
test_returns_array_friends
(hass, hass_client)
Test that a list of persons' current locations is returned.
Test that a list of persons' current locations is returned.
async def test_returns_array_friends(hass, hass_client): """Test that a list of persons' current locations is returned.""" otracks = MockConfigEntry( domain="owntracks", data={"webhook_id": "owntracks_test", "secret": "abcd"} ) otracks.add_to_hass(hass) await hass.config_entries.async_setup...
[ "async", "def", "test_returns_array_friends", "(", "hass", ",", "hass_client", ")", ":", "otracks", "=", "MockConfigEntry", "(", "domain", "=", "\"owntracks\"", ",", "data", "=", "{", "\"webhook_id\"", ":", "\"owntracks_test\"", ",", "\"secret\"", ":", "\"abcd\"",...
[ 1584, 0 ]
[ 1629, 42 ]
python
en
['en', 'en', 'en']
True
mock_now
()
Fixture for dtutil.now.
Fixture for dtutil.now.
def mock_now(): """Fixture for dtutil.now.""" return dt_util.utcnow()
[ "def", "mock_now", "(", ")", ":", "return", "dt_util", ".", "utcnow", "(", ")" ]
[ 67, 0 ]
[ 69, 27 ]
python
da
['da', 'da', 'en']
True
async_setup_gree
(hass)
Set up the gree platform.
Set up the gree platform.
async def async_setup_gree(hass): """Set up the gree platform.""" MockConfigEntry(domain=GREE_DOMAIN).add_to_hass(hass) await async_setup_component(hass, GREE_DOMAIN, {GREE_DOMAIN: {"climate": {}}}) await hass.async_block_till_done()
[ "async", "def", "async_setup_gree", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "GREE_DOMAIN", ")", ".", "add_to_hass", "(", "hass", ")", "await", "async_setup_component", "(", "hass", ",", "GREE_DOMAIN", ",", "{", "GREE_DOMAIN", ":", "{", ...
[ 72, 0 ]
[ 76, 38 ]
python
en
['en', 'da', 'en']
True
test_discovery_called_once
(hass, discovery, device)
Test discovery is only ever called once.
Test discovery is only ever called once.
async def test_discovery_called_once(hass, discovery, device): """Test discovery is only ever called once.""" await async_setup_gree(hass) assert discovery.call_count == 1 await async_setup_gree(hass) assert discovery.call_count == 1
[ "async", "def", "test_discovery_called_once", "(", "hass", ",", "discovery", ",", "device", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "assert", "discovery", ".", "call_count", "==", "1", "await", "async_setup_gree", "(", "hass", ")", "assert", "...
[ 79, 0 ]
[ 85, 36 ]
python
en
['en', 'en', 'en']
True
test_discovery_setup
(hass, discovery, device)
Test setup of platform.
Test setup of platform.
async def test_discovery_setup(hass, discovery, device): """Test setup of platform.""" MockDevice1 = build_device_mock( name="fake-device-1", ipAddress="1.1.1.1", mac="aabbcc112233" ) MockDevice2 = build_device_mock( name="fake-device-2", ipAddress="2.2.2.2", mac="bbccdd223344" ) ...
[ "async", "def", "test_discovery_setup", "(", "hass", ",", "discovery", ",", "device", ")", ":", "MockDevice1", "=", "build_device_mock", "(", "name", "=", "\"fake-device-1\"", ",", "ipAddress", "=", "\"1.1.1.1\"", ",", "mac", "=", "\"aabbcc112233\"", ")", "MockD...
[ 88, 0 ]
[ 103, 50 ]
python
en
['en', 'da', 'en']
True
test_discovery_setup_connection_error
(hass, discovery, device)
Test gree integration is setup.
Test gree integration is setup.
async def test_discovery_setup_connection_error(hass, discovery, device): """Test gree integration is setup.""" MockDevice1 = build_device_mock(name="fake-device-1") MockDevice1.bind = AsyncMock(side_effect=DeviceNotBoundError) MockDevice2 = build_device_mock(name="fake-device-2") MockDevice2.bind ...
[ "async", "def", "test_discovery_setup_connection_error", "(", "hass", ",", "discovery", ",", "device", ")", ":", "MockDevice1", "=", "build_device_mock", "(", "name", "=", "\"fake-device-1\"", ")", "MockDevice1", ".", "bind", "=", "AsyncMock", "(", "side_effect", ...
[ 106, 0 ]
[ 120, 44 ]
python
en
['en', 'da', 'en']
True
test_update_connection_failure
(hass, discovery, device, mock_now)
Testing update hvac connection failure exception.
Testing update hvac connection failure exception.
async def test_update_connection_failure(hass, discovery, device, mock_now): """Testing update hvac connection failure exception.""" device().update_state.side_effect = [ DEFAULT_MOCK, DeviceTimeoutError, DeviceTimeoutError, ] await async_setup_gree(hass) next_update = mock...
[ "async", "def", "test_update_connection_failure", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "update_state", ".", "side_effect", "=", "[", "DEFAULT_MOCK", ",", "DeviceTimeoutError", ",", "DeviceTimeoutError", ...
[ 123, 0 ]
[ 156, 43 ]
python
en
['en', 'en', 'en']
True
test_update_connection_failure_recovery
(hass, discovery, device, mock_now)
Testing update hvac connection failure recovery.
Testing update hvac connection failure recovery.
async def test_update_connection_failure_recovery(hass, discovery, device, mock_now): """Testing update hvac connection failure recovery.""" device().update_state.side_effect = [DeviceTimeoutError, DEFAULT_MOCK] await async_setup_gree(hass) next_update = mock_now + timedelta(minutes=5) with patch(...
[ "async", "def", "test_update_connection_failure_recovery", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "update_state", ".", "side_effect", "=", "[", "DeviceTimeoutError", ",", "DEFAULT_MOCK", "]", "await", "a...
[ 159, 0 ]
[ 181, 43 ]
python
en
['en', 'en', 'en']
True
test_update_unhandled_exception
(hass, discovery, device, mock_now)
Testing update hvac connection unhandled response exception.
Testing update hvac connection unhandled response exception.
async def test_update_unhandled_exception(hass, discovery, device, mock_now): """Testing update hvac connection unhandled response exception.""" device().update_state.side_effect = [DEFAULT_MOCK, Exception] await async_setup_gree(hass) next_update = mock_now + timedelta(minutes=5) with patch("home...
[ "async", "def", "test_update_unhandled_exception", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "update_state", ".", "side_effect", "=", "[", "DEFAULT_MOCK", ",", "Exception", "]", "await", "async_setup_gree",...
[ 184, 0 ]
[ 206, 43 ]
python
en
['en', 'en', 'en']
True
test_send_command_device_timeout
(hass, discovery, device, mock_now)
Test for sending power on command to the device with a device timeout.
Test for sending power on command to the device with a device timeout.
async def test_send_command_device_timeout(hass, discovery, device, mock_now): """Test for sending power on command to the device with a device timeout.""" await async_setup_gree(hass) # First update to make the device available next_update = mock_now + timedelta(minutes=5) with patch("homeassistan...
[ "async", "def", "test_send_command_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "# First update to make the device available", "next_update", "=", "mock_now", "+", "timedelta", ...
[ 209, 0 ]
[ 248, 43 ]
python
en
['en', 'en', 'en']
True
test_send_command_device_unknown_error
(hass, discovery, device, mock_now)
Test for sending power on command to the device with a device timeout.
Test for sending power on command to the device with a device timeout.
async def test_send_command_device_unknown_error(hass, discovery, device, mock_now): """Test for sending power on command to the device with a device timeout.""" device().update_state.side_effect = [DEFAULT_MOCK, Exception] device().push_state_update.side_effect = Exception await async_setup_gree(hass)...
[ "async", "def", "test_send_command_device_unknown_error", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "update_state", ".", "side_effect", "=", "[", "DEFAULT_MOCK", ",", "Exception", "]", "device", "(", ")",...
[ 251, 0 ]
[ 277, 43 ]
python
en
['en', 'en', 'en']
True
test_send_power_on
(hass, discovery, device, mock_now)
Test for sending power on command to the device.
Test for sending power on command to the device.
async def test_send_power_on(hass, discovery, device, mock_now): """Test for sending power on command to the device.""" await async_setup_gree(hass) next_update = mock_now + timedelta(minutes=5) with patch("homeassistant.util.dt.utcnow", return_value=next_update): async_fire_time_changed(hass, ...
[ "async", "def", "test_send_power_on", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "next_update", "=", "mock_now", "+", "timedelta", "(", "minutes", "=", "5", ")", "with", "patch", ...
[ 280, 0 ]
[ 298, 40 ]
python
en
['en', 'en', 'en']
True
test_send_power_on_device_timeout
(hass, discovery, device, mock_now)
Test for sending power on command to the device with a device timeout.
Test for sending power on command to the device with a device timeout.
async def test_send_power_on_device_timeout(hass, discovery, device, mock_now): """Test for sending power on command to the device with a device timeout.""" device().push_state_update.side_effect = DeviceTimeoutError await async_setup_gree(hass) next_update = mock_now + timedelta(minutes=5) with p...
[ "async", "def", "test_send_power_on_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "push_state_update", ".", "side_effect", "=", "DeviceTimeoutError", "await", "async_setup_gree", "(", "hass", ")"...
[ 301, 0 ]
[ 321, 40 ]
python
en
['en', 'en', 'en']
True
test_send_target_temperature
(hass, discovery, device, mock_now)
Test for sending target temperature command to the device.
Test for sending target temperature command to the device.
async def test_send_target_temperature(hass, discovery, device, mock_now): """Test for sending target temperature command to the device.""" await async_setup_gree(hass) next_update = mock_now + timedelta(minutes=5) with patch("homeassistant.util.dt.utcnow", return_value=next_update): async_fire...
[ "async", "def", "test_send_target_temperature", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "next_update", "=", "mock_now", "+", "timedelta", "(", "minutes", "=", "5", ")", "with", "...
[ 324, 0 ]
[ 342, 55 ]
python
en
['en', 'en', 'en']
True
test_send_target_temperature_device_timeout
( hass, discovery, device, mock_now )
Test for sending target temperature command to the device with a device timeout.
Test for sending target temperature command to the device with a device timeout.
async def test_send_target_temperature_device_timeout( hass, discovery, device, mock_now ): """Test for sending target temperature command to the device with a device timeout.""" device().push_state_update.side_effect = DeviceTimeoutError await async_setup_gree(hass) next_update = mock_now + timed...
[ "async", "def", "test_send_target_temperature_device_timeout", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "push_state_update", ".", "side_effect", "=", "DeviceTimeoutError", "await", "async_setup_gree", "(", "ha...
[ 345, 0 ]
[ 367, 55 ]
python
en
['en', 'en', 'en']
True
test_update_target_temperature
(hass, discovery, device, mock_now)
Test for updating target temperature from the device.
Test for updating target temperature from the device.
async def test_update_target_temperature(hass, discovery, device, mock_now): """Test for updating target temperature from the device.""" device().target_temperature = 32 await async_setup_gree(hass) next_update = mock_now + timedelta(minutes=5) with patch("homeassistant.util.dt.utcnow", return_val...
[ "async", "def", "test_update_target_temperature", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "device", "(", ")", ".", "target_temperature", "=", "32", "await", "async_setup_gree", "(", "hass", ")", "next_update", "=", "mock_now", ...
[ 370, 0 ]
[ 383, 55 ]
python
en
['en', 'en', 'en']
True
test_send_preset_mode
(hass, discovery, device, mock_now, preset)
Test for sending preset mode command to the device.
Test for sending preset mode command to the device.
async def test_send_preset_mode(hass, discovery, device, mock_now, preset): """Test for sending preset mode command to the device.""" await async_setup_gree(hass) next_update = mock_now + timedelta(minutes=5) with patch("homeassistant.util.dt.utcnow", return_value=next_update): async_fire_time_...
[ "async", "def", "test_send_preset_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ",", "preset", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "next_update", "=", "mock_now", "+", "timedelta", "(", "minutes", "=", "5", ")", ...
[ 389, 0 ]
[ 407, 59 ]
python
en
['en', 'en', 'en']
True
test_send_invalid_preset_mode
(hass, discovery, device, mock_now)
Test for sending preset mode command to the device.
Test for sending preset mode command to the device.
async def test_send_invalid_preset_mode(hass, discovery, device, mock_now): """Test for sending preset mode command to the device.""" await async_setup_gree(hass) next_update = mock_now + timedelta(minutes=5) with patch("homeassistant.util.dt.utcnow", return_value=next_update): async_fire_time_...
[ "async", "def", "test_send_invalid_preset_mode", "(", "hass", ",", "discovery", ",", "device", ",", "mock_now", ")", ":", "await", "async_setup_gree", "(", "hass", ")", "next_update", "=", "mock_now", "+", "timedelta", "(", "minutes", "=", "5", ")", "with", ...
[ 410, 0 ]
[ 429, 62 ]
python
en
['en', 'en', 'en']
True