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
ConfigFlow.async_step_pick_device
(self, user_input=None)
Handle the step to pick discovered device.
Handle the step to pick discovered device.
async def async_step_pick_device(self, user_input=None): """Handle the step to pick discovered device.""" if user_input is not None: unique_id = user_input[CONF_DEVICE] capabilities = self._discovered_devices[unique_id] await self.async_set_unique_id(unique_id) ...
[ "async", "def", "async_step_pick_device", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "unique_id", "=", "user_input", "[", "CONF_DEVICE", "]", "capabilities", "=", "self", ".", "_discovered_devices", "["...
[ 70, 4 ]
[ 108, 9 ]
python
en
['en', 'en', 'en']
True
ConfigFlow.async_step_import
(self, user_input=None)
Handle import step.
Handle import step.
async def async_step_import(self, user_input=None): """Handle import step.""" host = user_input[CONF_HOST] try: await self._async_try_connect(host) except CannotConnect: _LOGGER.error("Failed to import %s: cannot connect", host) return self.async_abort...
[ "async", "def", "async_step_import", "(", "self", ",", "user_input", "=", "None", ")", ":", "host", "=", "user_input", "[", "CONF_HOST", "]", "try", ":", "await", "self", ".", "_async_try_connect", "(", "host", ")", "except", "CannotConnect", ":", "_LOGGER",...
[ 110, 4 ]
[ 125, 84 ]
python
en
['en', 'en', 'en']
True
ConfigFlow._async_try_connect
(self, host)
Set up with options.
Set up with options.
async def _async_try_connect(self, host): """Set up with options.""" for entry in self._async_current_entries(): if entry.data.get(CONF_HOST) == host: raise AlreadyConfigured bulb = yeelight.Bulb(host) try: capabilities = await self.hass.async_add...
[ "async", "def", "_async_try_connect", "(", "self", ",", "host", ")", ":", "for", "entry", "in", "self", ".", "_async_current_entries", "(", ")", ":", "if", "entry", ".", "data", ".", "get", "(", "CONF_HOST", ")", "==", "host", ":", "raise", "AlreadyConfi...
[ 127, 4 ]
[ 154, 65 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.__init__
(self, config_entry)
Initialize the option flow.
Initialize the option flow.
def __init__(self, config_entry): """Initialize the option flow.""" self._config_entry = config_entry
[ "def", "__init__", "(", "self", ",", "config_entry", ")", ":", "self", ".", "_config_entry", "=", "config_entry" ]
[ 160, 4 ]
[ 162, 41 ]
python
en
['en', 'en', 'en']
True
OptionsFlowHandler.async_step_init
(self, user_input=None)
Handle the initial step.
Handle the initial step.
async def async_step_init(self, user_input=None): """Handle the initial step.""" if user_input is not None: options = {**self._config_entry.options} options.update(user_input) return self.async_create_entry(title="", data=options) options = self._config_entry...
[ "async", "def", "async_step_init", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "not", "None", ":", "options", "=", "{", "*", "*", "self", ".", "_config_entry", ".", "options", "}", "options", ".", "update", "(", "us...
[ 164, 4 ]
[ 194, 9 ]
python
en
['en', 'en', 'en']
True
get_imei_from_config
(hass: core.HomeAssistant, data)
Validate the user input allows us to connect. Data has the keys from DATA_SCHEMA with values provided by the user.
Validate the user input allows us to connect.
async def get_imei_from_config(hass: core.HomeAssistant, data): """Validate the user input allows us to connect. Data has the keys from DATA_SCHEMA with values provided by the user. """ device = data[CONF_DEVICE] config = {"Device": device, "Connection": "at"} gateway = await create_sms_gateway...
[ "async", "def", "get_imei_from_config", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "data", ")", ":", "device", "=", "data", "[", "CONF_DEVICE", "]", "config", "=", "{", "\"Device\"", ":", "device", ",", "\"Connection\"", ":", "\"at\"", "}", "gate...
[ 17, 0 ]
[ 35, 15 ]
python
en
['en', 'en', 'en']
True
SMSFlowHandler.async_step_user
(self, user_input=None)
Handle the initial step.
Handle the initial step.
async def async_step_user(self, user_input=None): """Handle the initial step.""" if self._async_current_entries(): return self.async_abort(reason="single_instance_allowed") errors = {} if user_input is not None: try: imei = await get_imei_from_conf...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "self", ".", "_async_current_entries", "(", ")", ":", "return", "self", ".", "async_abort", "(", "reason", "=", "\"single_instance_allowed\"", ")", "errors", "=", ...
[ 44, 4 ]
[ 65, 9 ]
python
en
['en', 'en', 'en']
True
SMSFlowHandler.async_step_import
(self, user_input)
Handle import.
Handle import.
async def async_step_import(self, user_input): """Handle import.""" return await self.async_step_user(user_input)
[ "async", "def", "async_step_import", "(", "self", ",", "user_input", ")", ":", "return", "await", "self", ".", "async_step_user", "(", "user_input", ")" ]
[ 67, 4 ]
[ 69, 53 ]
python
en
['en', 'ja', 'en']
False
async_register
( hass: HomeAssistant, register: system_health.SystemHealthRegistration )
Register system health callbacks.
Register system health callbacks.
def async_register( hass: HomeAssistant, register: system_health.SystemHealthRegistration ) -> None: """Register system health callbacks.""" register.async_register_info(system_health_info, "/hassio")
[ "def", "async_register", "(", "hass", ":", "HomeAssistant", ",", "register", ":", "system_health", ".", "SystemHealthRegistration", ")", "->", "None", ":", "register", ".", "async_register_info", "(", "system_health_info", ",", "\"/hassio\"", ")" ]
[ 11, 0 ]
[ 15, 63 ]
python
en
['en', 'sv', 'en']
True
system_health_info
(hass: HomeAssistant)
Get info for the info page.
Get info for the info page.
async def system_health_info(hass: HomeAssistant): """Get info for the info page.""" info = hass.components.hassio.get_info() host_info = hass.components.hassio.get_host_info() supervisor_info = hass.components.hassio.get_supervisor_info() if supervisor_info.get("healthy"): healthy = True ...
[ "async", "def", "system_health_info", "(", "hass", ":", "HomeAssistant", ")", ":", "info", "=", "hass", ".", "components", ".", "hassio", ".", "get_info", "(", ")", "host_info", "=", "hass", ".", "components", ".", "hassio", ".", "get_host_info", "(", ")",...
[ 18, 0 ]
[ 71, 22 ]
python
en
['en', 'en', 'en']
True
EventBindBinaryReader.start_datetime
(self)
datetime: Start datetime of this binary file.
datetime: Start datetime of this binary file.
def start_datetime(self) -> datetime: """datetime: Start datetime of this binary file.""" return self._reader.start_datetime
[ "def", "start_datetime", "(", "self", ")", "->", "datetime", ":", "return", "self", ".", "_reader", ".", "start_datetime" ]
[ 79, 4 ]
[ 81, 42 ]
python
en
['en', 'en', 'en']
True
EventBindBinaryReader.end_datetime
(self)
datetime: End datetime of this binary file.
datetime: End datetime of this binary file.
def end_datetime(self) -> datetime: """datetime: End datetime of this binary file.""" return self._reader.end_datetime
[ "def", "end_datetime", "(", "self", ")", "->", "datetime", ":", "return", "self", ".", "_reader", ".", "end_datetime" ]
[ 84, 4 ]
[ 86, 40 ]
python
en
['en', 'en', 'en']
True
EventBindBinaryReader.header
(self)
tuple: Header in binary file.
tuple: Header in binary file.
def header(self) -> tuple: """tuple: Header in binary file.""" return self._reader.header
[ "def", "header", "(", "self", ")", "->", "tuple", ":", "return", "self", ".", "_reader", ".", "header" ]
[ 89, 4 ]
[ 91, 34 ]
python
en
['en', 'ha', 'en']
True
EventBindBinaryReader.read_items
(self, tick: int)
Read items by tick and generate related events, then insert them into EventBuffer. Args: tick(int): Tick to get items, NOTE: the tick must specified sequentially.
Read items by tick and generate related events, then insert them into EventBuffer.
def read_items(self, tick: int): """Read items by tick and generate related events, then insert them into EventBuffer. Args: tick(int): Tick to get items, NOTE: the tick must specified sequentially. """ if self._picker: for item in self._picker.items(tick): ...
[ "def", "read_items", "(", "self", ",", "tick", ":", "int", ")", ":", "if", "self", ".", "_picker", ":", "for", "item", "in", "self", ".", "_picker", ".", "items", "(", "tick", ")", ":", "self", ".", "_gen_event_by_item", "(", "item", ",", "tick", "...
[ 93, 4 ]
[ 103, 19 ]
python
en
['en', 'en', 'en']
True
EventBindBinaryReader.reset
(self)
Reset states of reader.
Reset states of reader.
def reset(self): """Reset states of reader.""" self._reader.reset() self._picker = self._reader.items_tick_picker(start_time_offset=self._start_tick, end_time_offset=self._end_tick, time_unit=self._time_unit)
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_reader", ".", "reset", "(", ")", "self", ".", "_picker", "=", "self", ".", "_reader", ".", "items_tick_picker", "(", "start_time_offset", "=", "self", ".", "_start_tick", ",", "end_time_offset", "=", ...
[ 105, 4 ]
[ 109, 112 ]
python
en
['en', 'jv', 'en']
True
_set_up_units
(hass)
Set up the tests.
Set up the tests.
def _set_up_units(hass): """Set up the tests.""" hass.config.units = UnitSystem( "custom", TEMP_CELSIUS, LENGTH_METERS, VOLUME_LITERS, MASS_GRAMS, PRESSURE_PA )
[ "def", "_set_up_units", "(", "hass", ")", ":", "hass", ".", "config", ".", "units", "=", "UnitSystem", "(", "\"custom\"", ",", "TEMP_CELSIUS", ",", "LENGTH_METERS", ",", "VOLUME_LITERS", ",", "MASS_GRAMS", ",", "PRESSURE_PA", ")" ]
[ 28, 0 ]
[ 32, 5 ]
python
en
['en', 'en', 'en']
True
render_to_info
(hass, template_str, variables=None)
Create render info from template.
Create render info from template.
def render_to_info(hass, template_str, variables=None): """Create render info from template.""" tmp = template.Template(template_str, hass) return tmp.async_render_to_info(variables)
[ "def", "render_to_info", "(", "hass", ",", "template_str", ",", "variables", "=", "None", ")", ":", "tmp", "=", "template", ".", "Template", "(", "template_str", ",", "hass", ")", "return", "tmp", ".", "async_render_to_info", "(", "variables", ")" ]
[ 35, 0 ]
[ 38, 46 ]
python
en
['en', 'en', 'en']
True
extract_entities
(hass, template_str, variables=None)
Extract entities from a template.
Extract entities from a template.
def extract_entities(hass, template_str, variables=None): """Extract entities from a template.""" info = render_to_info(hass, template_str, variables) return info.entities
[ "def", "extract_entities", "(", "hass", ",", "template_str", ",", "variables", "=", "None", ")", ":", "info", "=", "render_to_info", "(", "hass", ",", "template_str", ",", "variables", ")", "return", "info", ".", "entities" ]
[ 41, 0 ]
[ 44, 24 ]
python
en
['en', 'en', 'en']
True
assert_result_info
(info, result, entities=None, domains=None, all_states=False)
Check result info.
Check result info.
def assert_result_info(info, result, entities=None, domains=None, all_states=False): """Check result info.""" assert info.result() == result assert info.all_states == all_states assert info.filter("invalid_entity_name.somewhere") == all_states if entities is not None: assert info.entities ==...
[ "def", "assert_result_info", "(", "info", ",", "result", ",", "entities", "=", "None", ",", "domains", "=", "None", ",", "all_states", "=", "False", ")", ":", "assert", "info", ".", "result", "(", ")", "==", "result", "assert", "info", ".", "all_states",...
[ 47, 0 ]
[ 63, 44 ]
python
en
['en', 'kk', 'en']
True
test_template_equality
()
Test template comparison and hashing.
Test template comparison and hashing.
def test_template_equality(): """Test template comparison and hashing.""" template_one = template.Template("{{ template_one }}") template_one_1 = template.Template("{{ template_one }}") template_two = template.Template("{{ template_two }}") assert template_one == template_one_1 assert template_...
[ "def", "test_template_equality", "(", ")", ":", "template_one", "=", "template", ".", "Template", "(", "\"{{ template_one }}\"", ")", "template_one_1", "=", "template", ".", "Template", "(", "\"{{ template_one }}\"", ")", "template_two", "=", "template", ".", "Templ...
[ 66, 0 ]
[ 80, 49 ]
python
en
['en', 'en', 'en']
True
test_invalid_template
(hass)
Invalid template raises error.
Invalid template raises error.
def test_invalid_template(hass): """Invalid template raises error.""" tmpl = template.Template("{{", hass) with pytest.raises(TemplateError): tmpl.ensure_valid() with pytest.raises(TemplateError): tmpl.async_render() info = tmpl.async_render_to_info() with pytest.raises(Templa...
[ "def", "test_invalid_template", "(", "hass", ")", ":", "tmpl", "=", "template", ".", "Template", "(", "\"{{\"", ",", "hass", ")", "with", "pytest", ".", "raises", "(", "TemplateError", ")", ":", "tmpl", ".", "ensure_valid", "(", ")", "with", "pytest", "....
[ 83, 0 ]
[ 102, 27 ]
python
en
['fi', 'et', 'en']
False
test_referring_states_by_entity_id
(hass)
Test referring states by entity id.
Test referring states by entity id.
def test_referring_states_by_entity_id(hass): """Test referring states by entity id.""" hass.states.async_set("test.object", "happy") assert ( template.Template("{{ states.test.object.state }}", hass).async_render() == "happy" ) assert ( template.Template('{{ states["test.ob...
[ "def", "test_referring_states_by_entity_id", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"happy\"", ")", "assert", "(", "template", ".", "Template", "(", "\"{{ states.test.object.state }}\"", ",", "hass", ")", "."...
[ 105, 0 ]
[ 120, 5 ]
python
en
['en', 'en', 'en']
True
test_invalid_entity_id
(hass)
Test referring states by entity id.
Test referring states by entity id.
def test_invalid_entity_id(hass): """Test referring states by entity id.""" with pytest.raises(TemplateError): template.Template('{{ states["big.fat..."] }}', hass).async_render() with pytest.raises(TemplateError): template.Template('{{ states.test["big.fat..."] }}', hass).async_render() ...
[ "def", "test_invalid_entity_id", "(", "hass", ")", ":", "with", "pytest", ".", "raises", "(", "TemplateError", ")", ":", "template", ".", "Template", "(", "'{{ states[\"big.fat...\"] }}'", ",", "hass", ")", ".", "async_render", "(", ")", "with", "pytest", ".",...
[ 123, 0 ]
[ 130, 80 ]
python
en
['en', 'en', 'en']
True
test_raise_exception_on_error
(hass)
Test raising an exception on error.
Test raising an exception on error.
def test_raise_exception_on_error(hass): """Test raising an exception on error.""" with pytest.raises(TemplateError): template.Template("{{ invalid_syntax").ensure_valid()
[ "def", "test_raise_exception_on_error", "(", "hass", ")", ":", "with", "pytest", ".", "raises", "(", "TemplateError", ")", ":", "template", ".", "Template", "(", "\"{{ invalid_syntax\"", ")", ".", "ensure_valid", "(", ")" ]
[ 133, 0 ]
[ 136, 61 ]
python
en
['en', 'de', 'en']
True
test_iterating_all_states
(hass)
Test iterating all states.
Test iterating all states.
def test_iterating_all_states(hass): """Test iterating all states.""" tmpl_str = "{% for state in states %}{{ state.state }}{% endfor %}" info = render_to_info(hass, tmpl_str) assert_result_info(info, "", all_states=True) assert info.rate_limit == template.ALL_STATES_RATE_LIMIT hass.states.asy...
[ "def", "test_iterating_all_states", "(", "hass", ")", ":", "tmpl_str", "=", "\"{% for state in states %}{{ state.state }}{% endfor %}\"", "info", "=", "render_to_info", "(", "hass", ",", "tmpl_str", ")", "assert_result_info", "(", "info", ",", "\"\"", ",", "all_states",...
[ 139, 0 ]
[ 151, 69 ]
python
en
['en', 'en', 'en']
True
test_iterating_all_states_unavailable
(hass)
Test iterating all states unavailable.
Test iterating all states unavailable.
def test_iterating_all_states_unavailable(hass): """Test iterating all states unavailable.""" hass.states.async_set("test.object", "on") tmpl_str = "{{ states | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | count }}" info = render_to_info(hass, tmpl_str) assert info.all_s...
[ "def", "test_iterating_all_states_unavailable", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"on\"", ")", "tmpl_str", "=", "\"{{ states | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | count }}\"", "info"...
[ 154, 0 ]
[ 169, 61 ]
python
en
['en', 'en', 'it']
True
test_iterating_domain_states
(hass)
Test iterating domain states.
Test iterating domain states.
def test_iterating_domain_states(hass): """Test iterating domain states.""" tmpl_str = "{% for state in states.sensor %}{{ state.state }}{% endfor %}" info = render_to_info(hass, tmpl_str) assert_result_info(info, "", domains=["sensor"]) assert info.rate_limit == template.DOMAIN_STATES_RATE_LIMIT ...
[ "def", "test_iterating_domain_states", "(", "hass", ")", ":", "tmpl_str", "=", "\"{% for state in states.sensor %}{{ state.state }}{% endfor %}\"", "info", "=", "render_to_info", "(", "hass", ",", "tmpl_str", ")", "assert_result_info", "(", "info", ",", "\"\"", ",", "do...
[ 172, 0 ]
[ 190, 5 ]
python
en
['de', 'en', 'en']
True
test_float
(hass)
Test float.
Test float.
def test_float(hass): """Test float.""" hass.states.async_set("sensor.temperature", "12") assert ( template.Template( "{{ float(states.sensor.temperature.state) }}", hass ).async_render() == 12.0 ) assert ( template.Template( "{{ float(states...
[ "def", "test_float", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"sensor.temperature\"", ",", "\"12\"", ")", "assert", "(", "template", ".", "Template", "(", "\"{{ float(states.sensor.temperature.state) }}\"", ",", "hass", ")", ".", "a...
[ 193, 0 ]
[ 214, 5 ]
python
en
['en', 'da', 'en']
False
test_rounding_value
(hass)
Test rounding value.
Test rounding value.
def test_rounding_value(hass): """Test rounding value.""" hass.states.async_set("sensor.temperature", 12.78) assert ( template.Template( "{{ states.sensor.temperature.state | round(1) }}", hass ).async_render() == 12.8 ) assert ( template.Template( ...
[ "def", "test_rounding_value", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"sensor.temperature\"", ",", "12.78", ")", "assert", "(", "template", ".", "Template", "(", "\"{{ states.sensor.temperature.state | round(1) }}\"", ",", "hass", ")",...
[ 217, 0 ]
[ 254, 5 ]
python
en
['nl', 'no', 'en']
False
test_rounding_value_get_original_value_on_error
(hass)
Test rounding value get original value on error.
Test rounding value get original value on error.
def test_rounding_value_get_original_value_on_error(hass): """Test rounding value get original value on error.""" assert template.Template("{{ None | round }}", hass).async_render() is None assert ( template.Template('{{ "no_number" | round }}', hass).async_render() == "no_number" )
[ "def", "test_rounding_value_get_original_value_on_error", "(", "hass", ")", ":", "assert", "template", ".", "Template", "(", "\"{{ None | round }}\"", ",", "hass", ")", ".", "async_render", "(", ")", "is", "None", "assert", "(", "template", ".", "Template", "(", ...
[ 257, 0 ]
[ 264, 5 ]
python
en
['nl', 'la', 'en']
False
test_multiply
(hass)
Test multiply.
Test multiply.
def test_multiply(hass): """Test multiply.""" tests = {None: None, 10: 100, '"abcd"': "abcd"} for inp, out in tests.items(): assert ( template.Template( "{{ %s | multiply(10) | round }}" % inp, hass ).async_render() == out )
[ "def", "test_multiply", "(", "hass", ")", ":", "tests", "=", "{", "None", ":", "None", ",", "10", ":", "100", ",", "'\"abcd\"'", ":", "\"abcd\"", "}", "for", "inp", ",", "out", "in", "tests", ".", "items", "(", ")", ":", "assert", "(", "template", ...
[ 267, 0 ]
[ 277, 9 ]
python
en
['en', 'no', 'en']
False
test_logarithm
(hass)
Test logarithm.
Test logarithm.
def test_logarithm(hass): """Test logarithm.""" tests = [ (4, 2, 2.0), (1000, 10, 3.0), (math.e, "", 1.0), ('"invalid"', "_", "invalid"), (10, '"invalid"', 10.0), ] for value, base, expected in tests: assert ( template.Template( ...
[ "def", "test_logarithm", "(", "hass", ")", ":", "tests", "=", "[", "(", "4", ",", "2", ",", "2.0", ")", ",", "(", "1000", ",", "10", ",", "3.0", ")", ",", "(", "math", ".", "e", ",", "\"\"", ",", "1.0", ")", ",", "(", "'\"invalid\"'", ",", ...
[ 280, 0 ]
[ 303, 9 ]
python
en
['en', 'fr', 'it']
False
test_cos
(hass)
Test cosine.
Test cosine.
def test_cos(hass): """Test cosine.""" tests = [ (0, 1.0), (math.pi / 2, 0.0), (math.pi, -1.0), (math.pi * 1.5, -0.0), (math.pi / 10, 0.951), ("'error'", "error"), ] for value, expected in tests: assert ( template.Template("{{ %s | cos...
[ "def", "test_cos", "(", "hass", ")", ":", "tests", "=", "[", "(", "0", ",", "1.0", ")", ",", "(", "math", ".", "pi", "/", "2", ",", "0.0", ")", ",", "(", "math", ".", "pi", ",", "-", "1.0", ")", ",", "(", "math", ".", "pi", "*", "1.5", ...
[ 324, 0 ]
[ 339, 9 ]
python
en
['en', 'la', 'it']
False
test_tan
(hass)
Test tangent.
Test tangent.
def test_tan(hass): """Test tangent.""" tests = [ (0, 0.0), (math.pi, -0.0), (math.pi / 180 * 45, 1.0), (math.pi / 180 * 90, "1.633123935319537e+16"), (math.pi / 180 * 135, -1.0), ("'error'", "error"), ] for value, expected in tests: assert ( ...
[ "def", "test_tan", "(", "hass", ")", ":", "tests", "=", "[", "(", "0", ",", "0.0", ")", ",", "(", "math", ".", "pi", ",", "-", "0.0", ")", ",", "(", "math", ".", "pi", "/", "180", "*", "45", ",", "1.0", ")", ",", "(", "math", ".", "pi", ...
[ 342, 0 ]
[ 357, 9 ]
python
ja
['sv', 'ja', 'ur']
False
test_sqrt
(hass)
Test square root.
Test square root.
def test_sqrt(hass): """Test square root.""" tests = [ (0, 0.0), (1, 1.0), (2, 1.414), (10, 3.162), (100, 10.0), ("'error'", "error"), ] for value, expected in tests: assert ( template.Template("{{ %s | sqrt | round(3) }}" % value, has...
[ "def", "test_sqrt", "(", "hass", ")", ":", "tests", "=", "[", "(", "0", ",", "0.0", ")", ",", "(", "1", ",", "1.0", ")", ",", "(", "2", ",", "1.414", ")", ",", "(", "10", ",", "3.162", ")", ",", "(", "100", ",", "10.0", ")", ",", "(", "...
[ 360, 0 ]
[ 375, 9 ]
python
en
['en', 'en', 'en']
True
test_arc_sine
(hass)
Test arcus sine.
Test arcus sine.
def test_arc_sine(hass): """Test arcus sine.""" tests = [ (-2.0, -2.0), # value error (-1.0, -1.571), (-0.5, -0.524), (0.0, 0.0), (0.5, 0.524), (1.0, 1.571), (2.0, 2.0), # value error ('"error"', "error"), ] for value, expected in tests:...
[ "def", "test_arc_sine", "(", "hass", ")", ":", "tests", "=", "[", "(", "-", "2.0", ",", "-", "2.0", ")", ",", "# value error", "(", "-", "1.0", ",", "-", "1.571", ")", ",", "(", "-", "0.5", ",", "-", "0.524", ")", ",", "(", "0.0", ",", "0.0",...
[ 378, 0 ]
[ 395, 9 ]
python
en
['en', 'la', 'it']
False
test_arc_cos
(hass)
Test arcus cosine.
Test arcus cosine.
def test_arc_cos(hass): """Test arcus cosine.""" tests = [ (-2.0, -2.0), # value error (-1.0, 3.142), (-0.5, 2.094), (0.0, 1.571), (0.5, 1.047), (1.0, 0.0), (2.0, 2.0), # value error ('"error"', "error"), ] for value, expected in tests: ...
[ "def", "test_arc_cos", "(", "hass", ")", ":", "tests", "=", "[", "(", "-", "2.0", ",", "-", "2.0", ")", ",", "# value error", "(", "-", "1.0", ",", "3.142", ")", ",", "(", "-", "0.5", ",", "2.094", ")", ",", "(", "0.0", ",", "1.571", ")", ","...
[ 398, 0 ]
[ 415, 9 ]
python
en
['en', 'la', 'it']
False
test_arc_tan
(hass)
Test arcus tangent.
Test arcus tangent.
def test_arc_tan(hass): """Test arcus tangent.""" tests = [ (-10.0, -1.471), (-2.0, -1.107), (-1.0, -0.785), (-0.5, -0.464), (0.0, 0.0), (0.5, 0.464), (1.0, 0.785), (2.0, 1.107), (10.0, 1.471), ('"error"', "error"), ] for v...
[ "def", "test_arc_tan", "(", "hass", ")", ":", "tests", "=", "[", "(", "-", "10.0", ",", "-", "1.471", ")", ",", "(", "-", "2.0", ",", "-", "1.107", ")", ",", "(", "-", "1.0", ",", "-", "0.785", ")", ",", "(", "-", "0.5", ",", "-", "0.464", ...
[ 418, 0 ]
[ 437, 9 ]
python
it
['sv', 'la', 'it']
False
test_arc_tan2
(hass)
Test two parameter version of arcus tangent.
Test two parameter version of arcus tangent.
def test_arc_tan2(hass): """Test two parameter version of arcus tangent.""" tests = [ (-10.0, -10.0, -2.356), (-10.0, 0.0, -1.571), (-10.0, 10.0, -0.785), (0.0, -10.0, 3.142), (0.0, 0.0, 0.0), (0.0, 10.0, 0.0), (10.0, -10.0, 2.356), (10.0, 0.0, 1.5...
[ "def", "test_arc_tan2", "(", "hass", ")", ":", "tests", "=", "[", "(", "-", "10.0", ",", "-", "10.0", ",", "-", "2.356", ")", ",", "(", "-", "10.0", ",", "0.0", ",", "-", "1.571", ")", ",", "(", "-", "10.0", ",", "10.0", ",", "-", "0.785", ...
[ 440, 0 ]
[ 470, 9 ]
python
en
['en', 'en', 'en']
True
test_strptime
(hass)
Test the parse timestamp method.
Test the parse timestamp method.
def test_strptime(hass): """Test the parse timestamp method.""" tests = [ ("2016-10-19 15:22:05.588122 UTC", "%Y-%m-%d %H:%M:%S.%f %Z", None), ("2016-10-19 15:22:05.588122+0100", "%Y-%m-%d %H:%M:%S.%f%z", None), ("2016-10-19 15:22:05.588122", "%Y-%m-%d %H:%M:%S.%f", None), ("2016...
[ "def", "test_strptime", "(", "hass", ")", ":", "tests", "=", "[", "(", "\"2016-10-19 15:22:05.588122 UTC\"", ",", "\"%Y-%m-%d %H:%M:%S.%f %Z\"", ",", "None", ")", ",", "(", "\"2016-10-19 15:22:05.588122+0100\"", ",", "\"%Y-%m-%d %H:%M:%S.%f%z\"", ",", "None", ")", ","...
[ 473, 0 ]
[ 492, 71 ]
python
en
['en', 'en', 'en']
True
test_timestamp_custom
(hass)
Test the timestamps to custom filter.
Test the timestamps to custom filter.
def test_timestamp_custom(hass): """Test the timestamps to custom filter.""" now = dt_util.utcnow() tests = [ (None, None, None, None), (1469119144, None, True, "2016-07-21 16:39:04"), (1469119144, "%Y", True, 2016), (1469119144, "invalid", True, "invalid"), (dt_util....
[ "def", "test_timestamp_custom", "(", "hass", ")", ":", "now", "=", "dt_util", ".", "utcnow", "(", ")", "tests", "=", "[", "(", "None", ",", "None", ",", "None", ",", "None", ")", ",", "(", "1469119144", ",", "None", ",", "True", ",", "\"2016-07-21 16...
[ 495, 0 ]
[ 514, 88 ]
python
en
['en', 'en', 'en']
True
test_timestamp_local
(hass)
Test the timestamps to local filter.
Test the timestamps to local filter.
def test_timestamp_local(hass): """Test the timestamps to local filter.""" tests = {None: None, 1469119144: "2016-07-21 16:39:04"} for inp, out in tests.items(): assert ( template.Template("{{ %s | timestamp_local }}" % inp, hass).async_render() == out )
[ "def", "test_timestamp_local", "(", "hass", ")", ":", "tests", "=", "{", "None", ":", "None", ",", "1469119144", ":", "\"2016-07-21 16:39:04\"", "}", "for", "inp", ",", "out", "in", "tests", ".", "items", "(", ")", ":", "assert", "(", "template", ".", ...
[ 517, 0 ]
[ 525, 9 ]
python
en
['en', 'en', 'en']
True
test_as_local
(hass)
Test converting time to local.
Test converting time to local.
def test_as_local(hass): """Test converting time to local.""" hass.states.async_set("test.object", "available") last_updated = hass.states.get("test.object").last_updated assert template.Template( "{{ as_local(states.test.object.last_updated) }}", hass ).async_render() == str(dt_util.as_loc...
[ "def", "test_as_local", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"available\"", ")", "last_updated", "=", "hass", ".", "states", ".", "get", "(", "\"test.object\"", ")", ".", "last_updated", "assert", "te...
[ 528, 0 ]
[ 538, 59 ]
python
en
['en', 'en', 'en']
True
test_to_json
(hass)
Test the object to JSON string filter.
Test the object to JSON string filter.
def test_to_json(hass): """Test the object to JSON string filter.""" # Note that we're not testing the actual json.loads and json.dumps methods, # only the filters, so we don't need to be exhaustive with our sample JSON. expected_result = {"Foo": "Bar"} actual_result = template.Template( "{...
[ "def", "test_to_json", "(", "hass", ")", ":", "# Note that we're not testing the actual json.loads and json.dumps methods,", "# only the filters, so we don't need to be exhaustive with our sample JSON.", "expected_result", "=", "{", "\"Foo\"", ":", "\"Bar\"", "}", "actual_result", "=...
[ 541, 0 ]
[ 550, 43 ]
python
en
['en', 'en', 'en']
True
test_from_json
(hass)
Test the JSON string to object filter.
Test the JSON string to object filter.
def test_from_json(hass): """Test the JSON string to object filter.""" # Note that we're not testing the actual json.loads and json.dumps methods, # only the filters, so we don't need to be exhaustive with our sample JSON. expected_result = "Bar" actual_result = template.Template( '{{ (\'{"...
[ "def", "test_from_json", "(", "hass", ")", ":", "# Note that we're not testing the actual json.loads and json.dumps methods,", "# only the filters, so we don't need to be exhaustive with our sample JSON.", "expected_result", "=", "\"Bar\"", "actual_result", "=", "template", ".", "Templ...
[ 553, 0 ]
[ 562, 43 ]
python
en
['en', 'en', 'en']
True
test_min
(hass)
Test the min filter.
Test the min filter.
def test_min(hass): """Test the min filter.""" assert template.Template("{{ [1, 2, 3] | min }}", hass).async_render() == 1
[ "def", "test_min", "(", "hass", ")", ":", "assert", "template", ".", "Template", "(", "\"{{ [1, 2, 3] | min }}\"", ",", "hass", ")", ".", "async_render", "(", ")", "==", "1" ]
[ 565, 0 ]
[ 567, 79 ]
python
en
['en', 'en', 'en']
True
test_max
(hass)
Test the max filter.
Test the max filter.
def test_max(hass): """Test the max filter.""" assert template.Template("{{ [1, 2, 3] | max }}", hass).async_render() == 3
[ "def", "test_max", "(", "hass", ")", ":", "assert", "template", ".", "Template", "(", "\"{{ [1, 2, 3] | max }}\"", ",", "hass", ")", ".", "async_render", "(", ")", "==", "3" ]
[ 570, 0 ]
[ 572, 79 ]
python
en
['en', 'en', 'en']
True
test_ord
(hass)
Test the ord filter.
Test the ord filter.
def test_ord(hass): """Test the ord filter.""" assert template.Template('{{ "d" | ord }}', hass).async_render() == 100
[ "def", "test_ord", "(", "hass", ")", ":", "assert", "template", ".", "Template", "(", "'{{ \"d\" | ord }}'", ",", "hass", ")", ".", "async_render", "(", ")", "==", "100" ]
[ 575, 0 ]
[ 577, 75 ]
python
en
['en', 'en', 'en']
True
test_base64_encode
(hass)
Test the base64_encode filter.
Test the base64_encode filter.
def test_base64_encode(hass): """Test the base64_encode filter.""" assert ( template.Template('{{ "homeassistant" | base64_encode }}', hass).async_render() == "aG9tZWFzc2lzdGFudA==" )
[ "def", "test_base64_encode", "(", "hass", ")", ":", "assert", "(", "template", ".", "Template", "(", "'{{ \"homeassistant\" | base64_encode }}'", ",", "hass", ")", ".", "async_render", "(", ")", "==", "\"aG9tZWFzc2lzdGFudA==\"", ")" ]
[ 580, 0 ]
[ 585, 5 ]
python
en
['en', 'da', 'en']
True
test_base64_decode
(hass)
Test the base64_decode filter.
Test the base64_decode filter.
def test_base64_decode(hass): """Test the base64_decode filter.""" assert ( template.Template( '{{ "aG9tZWFzc2lzdGFudA==" | base64_decode }}', hass ).async_render() == "homeassistant" )
[ "def", "test_base64_decode", "(", "hass", ")", ":", "assert", "(", "template", ".", "Template", "(", "'{{ \"aG9tZWFzc2lzdGFudA==\" | base64_decode }}'", ",", "hass", ")", ".", "async_render", "(", ")", "==", "\"homeassistant\"", ")" ]
[ 588, 0 ]
[ 595, 5 ]
python
en
['en', 'en', 'en']
True
test_ordinal
(hass)
Test the ordinal filter.
Test the ordinal filter.
def test_ordinal(hass): """Test the ordinal filter.""" tests = [ (1, "1st"), (2, "2nd"), (3, "3rd"), (4, "4th"), (5, "5th"), (12, "12th"), (100, "100th"), (101, "101st"), ] for value, expected in tests: assert ( templat...
[ "def", "test_ordinal", "(", "hass", ")", ":", "tests", "=", "[", "(", "1", ",", "\"1st\"", ")", ",", "(", "2", ",", "\"2nd\"", ")", ",", "(", "3", ",", "\"3rd\"", ")", ",", "(", "4", ",", "\"4th\"", ")", ",", "(", "5", ",", "\"5th\"", ")", ...
[ 598, 0 ]
[ 615, 9 ]
python
en
['en', 'su', 'en']
True
test_timestamp_utc
(hass)
Test the timestamps to local filter.
Test the timestamps to local filter.
def test_timestamp_utc(hass): """Test the timestamps to local filter.""" now = dt_util.utcnow() tests = { None: None, 1469119144: "2016-07-21 16:39:04", dt_util.as_timestamp(now): now.strftime("%Y-%m-%d %H:%M:%S"), } for inp, out in tests.items(): assert ( ...
[ "def", "test_timestamp_utc", "(", "hass", ")", ":", "now", "=", "dt_util", ".", "utcnow", "(", ")", "tests", "=", "{", "None", ":", "None", ",", "1469119144", ":", "\"2016-07-21 16:39:04\"", ",", "dt_util", ".", "as_timestamp", "(", "now", ")", ":", "now...
[ 618, 0 ]
[ 631, 9 ]
python
en
['en', 'en', 'en']
True
test_as_timestamp
(hass)
Test the as_timestamp function.
Test the as_timestamp function.
def test_as_timestamp(hass): """Test the as_timestamp function.""" assert ( template.Template('{{ as_timestamp("invalid") }}', hass).async_render() is None ) hass.mock = None assert ( template.Template("{{ as_timestamp(states.mock) }}", hass).async_render() is None ) ...
[ "def", "test_as_timestamp", "(", "hass", ")", ":", "assert", "(", "template", ".", "Template", "(", "'{{ as_timestamp(\"invalid\") }}'", ",", "hass", ")", ".", "async_render", "(", ")", "is", "None", ")", "hass", ".", "mock", "=", "None", "assert", "(", "t...
[ 634, 0 ]
[ 649, 70 ]
python
en
['en', 'en', 'en']
True
test_random_every_time
(test_choice, hass)
Ensure the random filter runs every time, not just once.
Ensure the random filter runs every time, not just once.
def test_random_every_time(test_choice, hass): """Ensure the random filter runs every time, not just once.""" tpl = template.Template("{{ [1,2] | random }}", hass) test_choice.return_value = "foo" assert tpl.async_render() == "foo" test_choice.return_value = "bar" assert tpl.async_render() == "b...
[ "def", "test_random_every_time", "(", "test_choice", ",", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"{{ [1,2] | random }}\"", ",", "hass", ")", "test_choice", ".", "return_value", "=", "\"foo\"", "assert", "tpl", ".", "async_render", "(",...
[ 653, 0 ]
[ 659, 38 ]
python
en
['en', 'en', 'en']
True
test_passing_vars_as_keywords
(hass)
Test passing variables as keywords.
Test passing variables as keywords.
def test_passing_vars_as_keywords(hass): """Test passing variables as keywords.""" assert template.Template("{{ hello }}", hass).async_render(hello=127) == 127
[ "def", "test_passing_vars_as_keywords", "(", "hass", ")", ":", "assert", "template", ".", "Template", "(", "\"{{ hello }}\"", ",", "hass", ")", ".", "async_render", "(", "hello", "=", "127", ")", "==", "127" ]
[ 662, 0 ]
[ 664, 80 ]
python
en
['en', 'en', 'en']
True
test_passing_vars_as_vars
(hass)
Test passing variables as variables.
Test passing variables as variables.
def test_passing_vars_as_vars(hass): """Test passing variables as variables.""" assert template.Template("{{ hello }}", hass).async_render({"hello": 127}) == 127
[ "def", "test_passing_vars_as_vars", "(", "hass", ")", ":", "assert", "template", ".", "Template", "(", "\"{{ hello }}\"", ",", "hass", ")", ".", "async_render", "(", "{", "\"hello\"", ":", "127", "}", ")", "==", "127" ]
[ 667, 0 ]
[ 669, 85 ]
python
en
['en', 'en', 'en']
True
test_passing_vars_as_list
(hass)
Test passing variables as list.
Test passing variables as list.
def test_passing_vars_as_list(hass): """Test passing variables as list.""" assert template.render_complex( template.Template("{{ hello }}", hass), {"hello": ["foo", "bar"]} ) == ["foo", "bar"]
[ "def", "test_passing_vars_as_list", "(", "hass", ")", ":", "assert", "template", ".", "render_complex", "(", "template", ".", "Template", "(", "\"{{ hello }}\"", ",", "hass", ")", ",", "{", "\"hello\"", ":", "[", "\"foo\"", ",", "\"bar\"", "]", "}", ")", "...
[ 672, 0 ]
[ 676, 23 ]
python
en
['en', 'en', 'en']
True
test_passing_vars_as_list_element
(hass)
Test passing variables as list.
Test passing variables as list.
def test_passing_vars_as_list_element(hass): """Test passing variables as list.""" assert ( template.render_complex( template.Template("{{ hello[1] }}", hass), {"hello": ["foo", "bar"]} ) == "bar" )
[ "def", "test_passing_vars_as_list_element", "(", "hass", ")", ":", "assert", "(", "template", ".", "render_complex", "(", "template", ".", "Template", "(", "\"{{ hello[1] }}\"", ",", "hass", ")", ",", "{", "\"hello\"", ":", "[", "\"foo\"", ",", "\"bar\"", "]",...
[ 679, 0 ]
[ 686, 5 ]
python
en
['en', 'en', 'en']
True
test_passing_vars_as_dict_element
(hass)
Test passing variables as list.
Test passing variables as list.
def test_passing_vars_as_dict_element(hass): """Test passing variables as list.""" assert ( template.render_complex( template.Template("{{ hello.foo }}", hass), {"hello": {"foo": "bar"}} ) == "bar" )
[ "def", "test_passing_vars_as_dict_element", "(", "hass", ")", ":", "assert", "(", "template", ".", "render_complex", "(", "template", ".", "Template", "(", "\"{{ hello.foo }}\"", ",", "hass", ")", ",", "{", "\"hello\"", ":", "{", "\"foo\"", ":", "\"bar\"", "}"...
[ 689, 0 ]
[ 696, 5 ]
python
en
['en', 'en', 'en']
True
test_passing_vars_as_dict
(hass)
Test passing variables as list.
Test passing variables as list.
def test_passing_vars_as_dict(hass): """Test passing variables as list.""" assert template.render_complex( template.Template("{{ hello }}", hass), {"hello": {"foo": "bar"}} ) == {"foo": "bar"}
[ "def", "test_passing_vars_as_dict", "(", "hass", ")", ":", "assert", "template", ".", "render_complex", "(", "template", ".", "Template", "(", "\"{{ hello }}\"", ",", "hass", ")", ",", "{", "\"hello\"", ":", "{", "\"foo\"", ":", "\"bar\"", "}", "}", ")", "...
[ 699, 0 ]
[ 703, 23 ]
python
en
['en', 'en', 'en']
True
test_render_with_possible_json_value_with_valid_json
(hass)
Render with possible JSON value with valid JSON.
Render with possible JSON value with valid JSON.
def test_render_with_possible_json_value_with_valid_json(hass): """Render with possible JSON value with valid JSON.""" tpl = template.Template("{{ value_json.hello }}", hass) assert tpl.async_render_with_possible_json_value('{"hello": "world"}') == "world"
[ "def", "test_render_with_possible_json_value_with_valid_json", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"{{ value_json.hello }}\"", ",", "hass", ")", "assert", "tpl", ".", "async_render_with_possible_json_value", "(", "'{\"hello\": \"world\"}'"...
[ 706, 0 ]
[ 709, 85 ]
python
en
['en', 'en', 'en']
True
test_render_with_possible_json_value_with_invalid_json
(hass)
Render with possible JSON value with invalid JSON.
Render with possible JSON value with invalid JSON.
def test_render_with_possible_json_value_with_invalid_json(hass): """Render with possible JSON value with invalid JSON.""" tpl = template.Template("{{ value_json }}", hass) assert tpl.async_render_with_possible_json_value("{ I AM NOT JSON }") == ""
[ "def", "test_render_with_possible_json_value_with_invalid_json", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"{{ value_json }}\"", ",", "hass", ")", "assert", "tpl", ".", "async_render_with_possible_json_value", "(", "\"{ I AM NOT JSON }\"", ")"...
[ 712, 0 ]
[ 715, 79 ]
python
en
['en', 'en', 'en']
True
test_render_with_possible_json_value_with_template_error_value
(hass)
Render with possible JSON value with template error value.
Render with possible JSON value with template error value.
def test_render_with_possible_json_value_with_template_error_value(hass): """Render with possible JSON value with template error value.""" tpl = template.Template("{{ non_existing.variable }}", hass) assert tpl.async_render_with_possible_json_value("hello", "-") == "-"
[ "def", "test_render_with_possible_json_value_with_template_error_value", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"{{ non_existing.variable }}\"", ",", "hass", ")", "assert", "tpl", ".", "async_render_with_possible_json_value", "(", "\"hello\""...
[ 718, 0 ]
[ 721, 73 ]
python
en
['en', 'en', 'en']
True
test_render_with_possible_json_value_with_missing_json_value
(hass)
Render with possible JSON value with unknown JSON object.
Render with possible JSON value with unknown JSON object.
def test_render_with_possible_json_value_with_missing_json_value(hass): """Render with possible JSON value with unknown JSON object.""" tpl = template.Template("{{ value_json.goodbye }}", hass) assert tpl.async_render_with_possible_json_value('{"hello": "world"}') == ""
[ "def", "test_render_with_possible_json_value_with_missing_json_value", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"{{ value_json.goodbye }}\"", ",", "hass", ")", "assert", "tpl", ".", "async_render_with_possible_json_value", "(", "'{\"hello\": \"...
[ 724, 0 ]
[ 727, 80 ]
python
en
['en', 'en', 'en']
True
test_render_with_possible_json_value_valid_with_is_defined
(hass)
Render with possible JSON value with known JSON object.
Render with possible JSON value with known JSON object.
def test_render_with_possible_json_value_valid_with_is_defined(hass): """Render with possible JSON value with known JSON object.""" tpl = template.Template("{{ value_json.hello|is_defined }}", hass) assert tpl.async_render_with_possible_json_value('{"hello": "world"}') == "world"
[ "def", "test_render_with_possible_json_value_valid_with_is_defined", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"{{ value_json.hello|is_defined }}\"", ",", "hass", ")", "assert", "tpl", ".", "async_render_with_possible_json_value", "(", "'{\"hell...
[ 730, 0 ]
[ 733, 85 ]
python
en
['en', 'en', 'en']
True
test_render_with_possible_json_value_undefined_json
(hass)
Render with possible JSON value with unknown JSON object.
Render with possible JSON value with unknown JSON object.
def test_render_with_possible_json_value_undefined_json(hass): """Render with possible JSON value with unknown JSON object.""" tpl = template.Template("{{ value_json.bye|is_defined }}", hass) assert ( tpl.async_render_with_possible_json_value('{"hello": "world"}') == '{"hello": "world"}' ...
[ "def", "test_render_with_possible_json_value_undefined_json", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"{{ value_json.bye|is_defined }}\"", ",", "hass", ")", "assert", "(", "tpl", ".", "async_render_with_possible_json_value", "(", "'{\"hello\...
[ 736, 0 ]
[ 742, 5 ]
python
en
['en', 'en', 'en']
True
test_render_with_possible_json_value_undefined_json_error_value
(hass)
Render with possible JSON value with unknown JSON object.
Render with possible JSON value with unknown JSON object.
def test_render_with_possible_json_value_undefined_json_error_value(hass): """Render with possible JSON value with unknown JSON object.""" tpl = template.Template("{{ value_json.bye|is_defined }}", hass) assert tpl.async_render_with_possible_json_value('{"hello": "world"}', "") == ""
[ "def", "test_render_with_possible_json_value_undefined_json_error_value", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"{{ value_json.bye|is_defined }}\"", ",", "hass", ")", "assert", "tpl", ".", "async_render_with_possible_json_value", "(", "'{\"h...
[ 745, 0 ]
[ 748, 84 ]
python
en
['en', 'en', 'en']
True
test_render_with_possible_json_value_non_string_value
(hass)
Render with possible JSON value with non-string value.
Render with possible JSON value with non-string value.
def test_render_with_possible_json_value_non_string_value(hass): """Render with possible JSON value with non-string value.""" tpl = template.Template( """ {{ strptime(value~'+0000', '%Y-%m-%d %H:%M:%S%z') }} """, hass, ) value = datetime(2019, 1, 18, 12, 13, 14) expected = st...
[ "def", "test_render_with_possible_json_value_non_string_value", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"\"\"\n{{ strptime(value~'+0000', '%Y-%m-%d %H:%M:%S%z') }}\n \"\"\"", ",", "hass", ",", ")", "value", "=", "datetime", "(", "2019",...
[ 751, 0 ]
[ 761, 71 ]
python
en
['en', 'en', 'en']
True
test_if_state_exists
(hass)
Test if state exists works.
Test if state exists works.
def test_if_state_exists(hass): """Test if state exists works.""" hass.states.async_set("test.object", "available") tpl = template.Template( "{% if states.test.object %}exists{% else %}not exists{% endif %}", hass ) assert tpl.async_render() == "exists"
[ "def", "test_if_state_exists", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"available\"", ")", "tpl", "=", "template", ".", "Template", "(", "\"{% if states.test.object %}exists{% else %}not exists{% endif %}\"", ",", ...
[ 764, 0 ]
[ 770, 41 ]
python
en
['en', 'en', 'en']
True
test_is_state
(hass)
Test is_state method.
Test is_state method.
def test_is_state(hass): """Test is_state method.""" hass.states.async_set("test.object", "available") tpl = template.Template( """ {% if is_state("test.object", "available") %}yes{% else %}no{% endif %} """, hass, ) assert tpl.async_render() == "yes" tpl = template.Temp...
[ "def", "test_is_state", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"available\"", ")", "tpl", "=", "template", ".", "Template", "(", "\"\"\"\n{% if is_state(\"test.object\", \"available\") %}yes{% else %}no{% endif %}\n ...
[ 773, 0 ]
[ 790, 38 ]
python
en
['en', 'en', 'en']
True
test_is_state_attr
(hass)
Test is_state_attr method.
Test is_state_attr method.
def test_is_state_attr(hass): """Test is_state_attr method.""" hass.states.async_set("test.object", "available", {"mode": "on"}) tpl = template.Template( """ {% if is_state_attr("test.object", "mode", "on") %}yes{% else %}no{% endif %} """, hass, ) assert tpl.async_render...
[ "def", "test_is_state_attr", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"available\"", ",", "{", "\"mode\"", ":", "\"on\"", "}", ")", "tpl", "=", "template", ".", "Template", "(", "\"\"\"\n{% if is_state_attr...
[ 793, 0 ]
[ 810, 38 ]
python
en
['en', 'en', 'en']
True
test_state_attr
(hass)
Test state_attr method.
Test state_attr method.
def test_state_attr(hass): """Test state_attr method.""" hass.states.async_set("test.object", "available", {"mode": "on"}) tpl = template.Template( """ {% if state_attr("test.object", "mode") == "on" %}yes{% else %}no{% endif %} """, hass, ) assert tpl.async_render() == "...
[ "def", "test_state_attr", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"available\"", ",", "{", "\"mode\"", ":", "\"on\"", "}", ")", "tpl", "=", "template", ".", "Template", "(", "\"\"\"\n{% if state_attr(\"tes...
[ 813, 0 ]
[ 830, 37 ]
python
en
['en', 'de', 'en']
True
test_states_function
(hass)
Test using states as a function.
Test using states as a function.
def test_states_function(hass): """Test using states as a function.""" hass.states.async_set("test.object", "available") tpl = template.Template('{{ states("test.object") }}', hass) assert tpl.async_render() == "available" tpl2 = template.Template('{{ states("test.object2") }}', hass) assert tp...
[ "def", "test_states_function", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"available\"", ")", "tpl", "=", "template", ".", "Template", "(", "'{{ states(\"test.object\") }}'", ",", "hass", ")", "assert", "tpl", ...
[ 833, 0 ]
[ 840, 43 ]
python
en
['en', 'en', 'en']
True
test_now
(mock_is_safe, hass)
Test now method.
Test now method.
def test_now(mock_is_safe, hass): """Test now method.""" now = dt_util.now() with patch("homeassistant.util.dt.now", return_value=now): info = template.Template("{{ now().isoformat() }}", hass).async_render_to_info() assert now.isoformat() == info.result() assert info.has_time is True
[ "def", "test_now", "(", "mock_is_safe", ",", "hass", ")", ":", "now", "=", "dt_util", ".", "now", "(", ")", "with", "patch", "(", "\"homeassistant.util.dt.now\"", ",", "return_value", "=", "now", ")", ":", "info", "=", "template", ".", "Template", "(", "...
[ 847, 0 ]
[ 854, 32 ]
python
en
['en', 'sr', 'en']
True
test_utcnow
(mock_is_safe, hass)
Test now method.
Test now method.
def test_utcnow(mock_is_safe, hass): """Test now method.""" utcnow = dt_util.utcnow() with patch("homeassistant.util.dt.utcnow", return_value=utcnow): info = template.Template( "{{ utcnow().isoformat() }}", hass ).async_render_to_info() assert utcnow.isoformat() == info.r...
[ "def", "test_utcnow", "(", "mock_is_safe", ",", "hass", ")", ":", "utcnow", "=", "dt_util", ".", "utcnow", "(", ")", "with", "patch", "(", "\"homeassistant.util.dt.utcnow\"", ",", "return_value", "=", "utcnow", ")", ":", "info", "=", "template", ".", "Templa...
[ 861, 0 ]
[ 870, 32 ]
python
en
['en', 'sr', 'en']
True
test_relative_time
(mock_is_safe, hass)
Test relative_time method.
Test relative_time method.
def test_relative_time(mock_is_safe, hass): """Test relative_time method.""" now = datetime.strptime("2000-01-01 10:00:00 +00:00", "%Y-%m-%d %H:%M:%S %z") with patch("homeassistant.util.dt.now", return_value=now): assert ( "1 hour" == template.Template( '{{rel...
[ "def", "test_relative_time", "(", "mock_is_safe", ",", "hass", ")", ":", "now", "=", "datetime", ".", "strptime", "(", "\"2000-01-01 10:00:00 +00:00\"", ",", "\"%Y-%m-%d %H:%M:%S %z\"", ")", "with", "patch", "(", "\"homeassistant.util.dt.now\"", ",", "return_value", "...
[ 877, 0 ]
[ 915, 9 ]
python
en
['en', 'en', 'en']
True
test_timedelta
(mock_is_safe, hass)
Test relative_time method.
Test relative_time method.
def test_timedelta(mock_is_safe, hass): """Test relative_time method.""" now = datetime.strptime("2000-01-01 10:00:00 +00:00", "%Y-%m-%d %H:%M:%S %z") with patch("homeassistant.util.dt.now", return_value=now): assert ( "0:02:00" == template.Template( "{{timede...
[ "def", "test_timedelta", "(", "mock_is_safe", ",", "hass", ")", ":", "now", "=", "datetime", ".", "strptime", "(", "\"2000-01-01 10:00:00 +00:00\"", ",", "\"%Y-%m-%d %H:%M:%S %z\"", ")", "with", "patch", "(", "\"homeassistant.util.dt.now\"", ",", "return_value", "=", ...
[ 922, 0 ]
[ 974, 9 ]
python
en
['en', 'en', 'en']
True
test_regex_match
(hass)
Test regex_match method.
Test regex_match method.
def test_regex_match(hass): """Test regex_match method.""" tpl = template.Template( r""" {{ '123-456-7890' | regex_match('(\\d{3})-(\\d{3})-(\\d{4})') }} """, hass, ) assert tpl.async_render() is True tpl = template.Template( """ {{ 'Home Assistant test' | regex_...
[ "def", "test_regex_match", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "r\"\"\"\n{{ '123-456-7890' | regex_match('(\\\\d{3})-(\\\\d{3})-(\\\\d{4})') }}\n \"\"\"", ",", "hass", ",", ")", "assert", "tpl", ".", "async_render", "(", ")", ...
[ 977, 0 ]
[ 1009, 37 ]
python
de
['de', 'de', 'en']
True
test_regex_search
(hass)
Test regex_search method.
Test regex_search method.
def test_regex_search(hass): """Test regex_search method.""" tpl = template.Template( r""" {{ '123-456-7890' | regex_search('(\\d{3})-(\\d{3})-(\\d{4})') }} """, hass, ) assert tpl.async_render() is True tpl = template.Template( """ {{ 'Home Assistant test' | reg...
[ "def", "test_regex_search", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "r\"\"\"\n{{ '123-456-7890' | regex_search('(\\\\d{3})-(\\\\d{3})-(\\\\d{4})') }}\n \"\"\"", ",", "hass", ",", ")", "assert", "tpl", ".", "async_render", "(", ")", ...
[ 1012, 0 ]
[ 1044, 37 ]
python
cy
['de', 'cy', 'en']
False
test_regex_replace
(hass)
Test regex_replace method.
Test regex_replace method.
def test_regex_replace(hass): """Test regex_replace method.""" tpl = template.Template( r""" {{ 'Hello World' | regex_replace('(Hello\\s)',) }} """, hass, ) assert tpl.async_render() == "World" tpl = template.Template( """ {{ ['Home hinderant test'] | regex_repla...
[ "def", "test_regex_replace", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "r\"\"\"\n{{ 'Hello World' | regex_replace('(Hello\\\\s)',) }}\n \"\"\"", ",", "hass", ",", ")", "assert", "tpl", ".", "async_render", "(", ")", "==", "\"World...
[ 1047, 0 ]
[ 1063, 56 ]
python
en
['nl', 'la', 'en']
False
test_regex_findall_index
(hass)
Test regex_findall_index method.
Test regex_findall_index method.
def test_regex_findall_index(hass): """Test regex_findall_index method.""" tpl = template.Template( """ {{ 'Flight from JFK to LHR' | regex_findall_index('([A-Z]{3})', 0) }} """, hass, ) assert tpl.async_render() == "JFK" tpl = template.Template( """ {{ 'Flight f...
[ "def", "test_regex_findall_index", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"\"\"\n{{ 'Flight from JFK to LHR' | regex_findall_index('([A-Z]{3})', 0) }}\n \"\"\"", ",", "hass", ",", ")", "assert", "tpl", ".", "async_render", "(", "...
[ 1066, 0 ]
[ 1090, 38 ]
python
de
['nl', 'de', 'en']
False
test_bitwise_and
(hass)
Test bitwise_and method.
Test bitwise_and method.
def test_bitwise_and(hass): """Test bitwise_and method.""" tpl = template.Template( """ {{ 8 | bitwise_and(8) }} """, hass, ) assert tpl.async_render() == 8 & 8 tpl = template.Template( """ {{ 10 | bitwise_and(2) }} """, hass, ) assert ...
[ "def", "test_bitwise_and", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"\"\"\n{{ 8 | bitwise_and(8) }}\n \"\"\"", ",", "hass", ",", ")", "assert", "tpl", ".", "async_render", "(", ")", "==", "8", "&", "8", "tpl", "=", "t...
[ 1093, 0 ]
[ 1115, 38 ]
python
en
['en', 'en', 'en']
True
test_bitwise_or
(hass)
Test bitwise_or method.
Test bitwise_or method.
def test_bitwise_or(hass): """Test bitwise_or method.""" tpl = template.Template( """ {{ 8 | bitwise_or(8) }} """, hass, ) assert tpl.async_render() == 8 | 8 tpl = template.Template( """ {{ 10 | bitwise_or(2) }} """, hass, ) assert tpl....
[ "def", "test_bitwise_or", "(", "hass", ")", ":", "tpl", "=", "template", ".", "Template", "(", "\"\"\"\n{{ 8 | bitwise_or(8) }}\n \"\"\"", ",", "hass", ",", ")", "assert", "tpl", ".", "async_render", "(", ")", "==", "8", "|", "8", "tpl", "=", "tem...
[ 1118, 0 ]
[ 1140, 38 ]
python
en
['en', 'en', 'en']
True
test_distance_function_with_1_state
(hass)
Test distance function with 1 state.
Test distance function with 1 state.
def test_distance_function_with_1_state(hass): """Test distance function with 1 state.""" _set_up_units(hass) hass.states.async_set( "test.object", "happy", {"latitude": 32.87336, "longitude": -117.22943} ) tpl = template.Template("{{ distance(states.test.object) | round }}", hass) asser...
[ "def", "test_distance_function_with_1_state", "(", "hass", ")", ":", "_set_up_units", "(", "hass", ")", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "32.87336", ",", "\"longitude\"", ":", "-", ...
[ 1143, 0 ]
[ 1150, 36 ]
python
en
['en', 'en', 'en']
True
test_distance_function_with_2_states
(hass)
Test distance function with 2 states.
Test distance function with 2 states.
def test_distance_function_with_2_states(hass): """Test distance function with 2 states.""" _set_up_units(hass) hass.states.async_set( "test.object", "happy", {"latitude": 32.87336, "longitude": -117.22943} ) hass.states.async_set( "test.object_2", "happy", {"latitude...
[ "def", "test_distance_function_with_2_states", "(", "hass", ")", ":", "_set_up_units", "(", "hass", ")", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "32.87336", ",", "\"longitude\"", ":", "-",...
[ 1153, 0 ]
[ 1167, 36 ]
python
en
['en', 'en', 'en']
True
test_distance_function_with_1_coord
(hass)
Test distance function with 1 coord.
Test distance function with 1 coord.
def test_distance_function_with_1_coord(hass): """Test distance function with 1 coord.""" _set_up_units(hass) tpl = template.Template('{{ distance("32.87336", "-117.22943") | round }}', hass) assert tpl.async_render() == 187
[ "def", "test_distance_function_with_1_coord", "(", "hass", ")", ":", "_set_up_units", "(", "hass", ")", "tpl", "=", "template", ".", "Template", "(", "'{{ distance(\"32.87336\", \"-117.22943\") | round }}'", ",", "hass", ")", "assert", "tpl", ".", "async_render", "(",...
[ 1170, 0 ]
[ 1174, 36 ]
python
en
['en', 'en', 'en']
True
test_distance_function_with_2_coords
(hass)
Test distance function with 2 coords.
Test distance function with 2 coords.
def test_distance_function_with_2_coords(hass): """Test distance function with 2 coords.""" _set_up_units(hass) assert ( template.Template( '{{ distance("32.87336", "-117.22943", %s, %s) | round }}' % (hass.config.latitude, hass.config.longitude), hass, )....
[ "def", "test_distance_function_with_2_coords", "(", "hass", ")", ":", "_set_up_units", "(", "hass", ")", "assert", "(", "template", ".", "Template", "(", "'{{ distance(\"32.87336\", \"-117.22943\", %s, %s) | round }}'", "%", "(", "hass", ".", "config", ".", "latitude", ...
[ 1177, 0 ]
[ 1187, 5 ]
python
en
['en', 'en', 'en']
True
test_distance_function_with_1_state_1_coord
(hass)
Test distance function with 1 state 1 coord.
Test distance function with 1 state 1 coord.
def test_distance_function_with_1_state_1_coord(hass): """Test distance function with 1 state 1 coord.""" _set_up_units(hass) hass.states.async_set( "test.object_2", "happy", {"latitude": hass.config.latitude, "longitude": hass.config.longitude}, ) tpl = template.Template( ...
[ "def", "test_distance_function_with_1_state_1_coord", "(", "hass", ")", ":", "_set_up_units", "(", "hass", ")", "hass", ".", "states", ".", "async_set", "(", "\"test.object_2\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "hass", ".", "config", ".", "latit...
[ 1190, 0 ]
[ 1208, 37 ]
python
en
['en', 'en', 'en']
True
test_distance_function_return_none_if_invalid_state
(hass)
Test distance function return None if invalid state.
Test distance function return None if invalid state.
def test_distance_function_return_none_if_invalid_state(hass): """Test distance function return None if invalid state.""" hass.states.async_set("test.object_2", "happy", {"latitude": 10}) tpl = template.Template("{{ distance(states.test.object_2) | round }}", hass) assert tpl.async_render() is None
[ "def", "test_distance_function_return_none_if_invalid_state", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test.object_2\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "10", "}", ")", "tpl", "=", "template", ".", "Template", "(",...
[ 1211, 0 ]
[ 1215, 37 ]
python
en
['fr', 'en', 'en']
True
test_distance_function_return_none_if_invalid_coord
(hass)
Test distance function return None if invalid coord.
Test distance function return None if invalid coord.
def test_distance_function_return_none_if_invalid_coord(hass): """Test distance function return None if invalid coord.""" assert ( template.Template('{{ distance("123", "abc") }}', hass).async_render() is None ) assert template.Template('{{ distance("123") }}', hass).async_render() is None ...
[ "def", "test_distance_function_return_none_if_invalid_coord", "(", "hass", ")", ":", "assert", "(", "template", ".", "Template", "(", "'{{ distance(\"123\", \"abc\") }}'", ",", "hass", ")", ".", "async_render", "(", ")", "is", "None", ")", "assert", "template", ".",...
[ 1218, 0 ]
[ 1232, 37 ]
python
en
['fr', 'en', 'en']
True
test_distance_function_with_2_entity_ids
(hass)
Test distance function with 2 entity ids.
Test distance function with 2 entity ids.
def test_distance_function_with_2_entity_ids(hass): """Test distance function with 2 entity ids.""" _set_up_units(hass) hass.states.async_set( "test.object", "happy", {"latitude": 32.87336, "longitude": -117.22943} ) hass.states.async_set( "test.object_2", "happy", {"...
[ "def", "test_distance_function_with_2_entity_ids", "(", "hass", ")", ":", "_set_up_units", "(", "hass", ")", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "32.87336", ",", "\"longitude\"", ":", ...
[ 1235, 0 ]
[ 1249, 36 ]
python
en
['en', 'en', 'en']
True
test_distance_function_with_1_entity_1_coord
(hass)
Test distance function with 1 entity_id and 1 coord.
Test distance function with 1 entity_id and 1 coord.
def test_distance_function_with_1_entity_1_coord(hass): """Test distance function with 1 entity_id and 1 coord.""" _set_up_units(hass) hass.states.async_set( "test.object", "happy", {"latitude": hass.config.latitude, "longitude": hass.config.longitude}, ) tpl = template.Templ...
[ "def", "test_distance_function_with_1_entity_1_coord", "(", "hass", ")", ":", "_set_up_units", "(", "hass", ")", "hass", ".", "states", ".", "async_set", "(", "\"test.object\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "hass", ".", "config", ".", "latitu...
[ 1252, 0 ]
[ 1263, 36 ]
python
en
['en', 'en', 'en']
True
test_closest_function_home_vs_domain
(hass)
Test closest function home vs domain.
Test closest function home vs domain.
def test_closest_function_home_vs_domain(hass): """Test closest function home vs domain.""" hass.states.async_set( "test_domain.object", "happy", { "latitude": hass.config.latitude + 0.1, "longitude": hass.config.longitude + 0.1, }, ) hass.states....
[ "def", "test_closest_function_home_vs_domain", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test_domain.object\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "hass", ".", "config", ".", "latitude", "+", "0.1", ",", "\"longitude\"...
[ 1266, 0 ]
[ 1295, 5 ]
python
en
['fr', 'en', 'en']
True
test_closest_function_home_vs_all_states
(hass)
Test closest function home vs all states.
Test closest function home vs all states.
def test_closest_function_home_vs_all_states(hass): """Test closest function home vs all states.""" hass.states.async_set( "test_domain.object", "happy", { "latitude": hass.config.latitude + 0.1, "longitude": hass.config.longitude + 0.1, }, ) hass...
[ "def", "test_closest_function_home_vs_all_states", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test_domain.object\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "hass", ".", "config", ".", "latitude", "+", "0.1", ",", "\"longitu...
[ 1298, 0 ]
[ 1323, 5 ]
python
en
['en', 'en', 'en']
True
test_closest_function_home_vs_group_entity_id
(hass)
Test closest function home vs group entity id.
Test closest function home vs group entity id.
async def test_closest_function_home_vs_group_entity_id(hass): """Test closest function home vs group entity id.""" hass.states.async_set( "test_domain.object", "happy", { "latitude": hass.config.latitude + 0.1, "longitude": hass.config.longitude + 0.1, },...
[ "async", "def", "test_closest_function_home_vs_group_entity_id", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test_domain.object\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "hass", ".", "config", ".", "latitude", "+", "0.1", "...
[ 1326, 0 ]
[ 1351, 34 ]
python
en
['en', 'en', 'en']
True
test_closest_function_home_vs_group_state
(hass)
Test closest function home vs group state.
Test closest function home vs group state.
async def test_closest_function_home_vs_group_state(hass): """Test closest function home vs group state.""" hass.states.async_set( "test_domain.object", "happy", { "latitude": hass.config.latitude + 0.1, "longitude": hass.config.longitude + 0.1, }, ) ...
[ "async", "def", "test_closest_function_home_vs_group_state", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test_domain.object\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "hass", ".", "config", ".", "latitude", "+", "0.1", ",", ...
[ 1354, 0 ]
[ 1385, 34 ]
python
en
['en', 'en', 'en']
True
test_expand
(hass)
Test expand function.
Test expand function.
async def test_expand(hass): """Test expand function.""" info = render_to_info(hass, "{{ expand('test.object') }}") assert_result_info(info, [], ["test.object"]) assert info.rate_limit is None info = render_to_info(hass, "{{ expand(56) }}") assert_result_info(info, []) assert info.rate_limi...
[ "async", "def", "test_expand", "(", "hass", ")", ":", "info", "=", "render_to_info", "(", "hass", ",", "\"{{ expand('test.object') }}\"", ")", "assert_result_info", "(", "info", ",", "[", "]", ",", "[", "\"test.object\"", "]", ")", "assert", "info", ".", "ra...
[ 1388, 0 ]
[ 1470, 34 ]
python
en
['en', 'en', 'en']
True
test_closest_function_to_coord
(hass)
Test closest function to coord.
Test closest function to coord.
def test_closest_function_to_coord(hass): """Test closest function to coord.""" hass.states.async_set( "test_domain.closest_home", "happy", { "latitude": hass.config.latitude + 0.1, "longitude": hass.config.longitude + 0.1, }, ) hass.states.async_...
[ "def", "test_closest_function_to_coord", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"test_domain.closest_home\"", ",", "\"happy\"", ",", "{", "\"latitude\"", ":", "hass", ".", "config", ".", "latitude", "+", "0.1", ",", "\"longitude\"...
[ 1473, 0 ]
[ 1516, 59 ]
python
en
['en', 'en', 'en']
True
test_async_render_to_info_with_branching
(hass)
Test async_render_to_info function by domain.
Test async_render_to_info function by domain.
def test_async_render_to_info_with_branching(hass): """Test async_render_to_info function by domain.""" hass.states.async_set("light.a", "off") hass.states.async_set("light.b", "on") hass.states.async_set("light.c", "off") info = render_to_info( hass, """ {% if states.light.a == "on...
[ "def", "test_async_render_to_info_with_branching", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"light.a\"", ",", "\"off\"", ")", "hass", ".", "states", ".", "async_set", "(", "\"light.b\"", ",", "\"on\"", ")", "hass", ".", "states", ...
[ 1519, 0 ]
[ 1548, 34 ]
python
en
['en', 'en', 'en']
True
test_async_render_to_info_with_complex_branching
(hass)
Test async_render_to_info function by domain.
Test async_render_to_info function by domain.
def test_async_render_to_info_with_complex_branching(hass): """Test async_render_to_info function by domain.""" hass.states.async_set("light.a", "off") hass.states.async_set("light.b", "on") hass.states.async_set("light.c", "off") hass.states.async_set("vacuum.a", "off") hass.states.async_set("d...
[ "def", "test_async_render_to_info_with_complex_branching", "(", "hass", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"light.a\"", ",", "\"off\"", ")", "hass", ".", "states", ".", "async_set", "(", "\"light.b\"", ",", "\"on\"", ")", "hass", ".", "s...
[ 1551, 0 ]
[ 1585, 63 ]
python
en
['en', 'en', 'en']
True