Add native Python types support to templates (#41227)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
1 parent
cbb4324c84
commit
ee914366a8
29 files changed
+349
-282
No files matched your search
@@ -662,7 +662,7 @@ def _verify(
|
||||
"""Verify fan's state, speed and osc."""
|
||||
state = hass.states.get(_TEST_FAN)
|
||||
attributes = state.attributes
|
||||
assert state.state == expected_state
|
||||
assert state.state == str(expected_state)
|
||||
assert attributes.get(ATTR_SPEED) == expected_speed
|
||||
assert attributes.get(ATTR_OSCILLATING) == expected_oscillating
|
||||
assert attributes.get(ATTR_DIRECTION) == expected_direction
|
||||
|
||||
@@ -550,7 +550,7 @@ class TestTemplateLight:
|
||||
)
|
||||
self.hass.block_till_done()
|
||||
assert len(self.calls) == 1
|
||||
assert self.calls[0].data["white_value"] == "124"
|
||||
assert self.calls[0].data["white_value"] == 124
|
||||
|
||||
state = self.hass.states.get("light.test_template_light")
|
||||
assert state is not None
|
||||
@@ -649,7 +649,7 @@ class TestTemplateLight:
|
||||
common.turn_on(self.hass, "light.test_template_light", **{ATTR_BRIGHTNESS: 124})
|
||||
self.hass.block_till_done()
|
||||
assert len(self.calls) == 1
|
||||
assert self.calls[0].data["brightness"] == "124"
|
||||
assert self.calls[0].data["brightness"] == 124
|
||||
|
||||
state = self.hass.states.get("light.test_template_light")
|
||||
_LOGGER.info(str(state.attributes))
|
||||
@@ -802,7 +802,7 @@ class TestTemplateLight:
|
||||
common.turn_on(self.hass, "light.test_template_light", **{ATTR_COLOR_TEMP: 345})
|
||||
self.hass.block_till_done()
|
||||
assert len(self.calls) == 1
|
||||
assert self.calls[0].data["color_temp"] == "345"
|
||||
assert self.calls[0].data["color_temp"] == 345
|
||||
|
||||
state = self.hass.states.get("light.test_template_light")
|
||||
_LOGGER.info(str(state.attributes))
|
||||
@@ -1008,18 +1008,18 @@ class TestTemplateLight:
|
||||
)
|
||||
self.hass.block_till_done()
|
||||
assert len(self.calls) == 2
|
||||
assert self.calls[0].data["h"] == "40"
|
||||
assert self.calls[0].data["s"] == "50"
|
||||
assert self.calls[1].data["h"] == "40"
|
||||
assert self.calls[1].data["s"] == "50"
|
||||
assert self.calls[0].data["h"] == 40
|
||||
assert self.calls[0].data["s"] == 50
|
||||
assert self.calls[1].data["h"] == 40
|
||||
assert self.calls[1].data["s"] == 50
|
||||
|
||||
state = self.hass.states.get("light.test_template_light")
|
||||
_LOGGER.info(str(state.attributes))
|
||||
assert state is not None
|
||||
assert self.calls[0].data["h"] == "40"
|
||||
assert self.calls[0].data["s"] == "50"
|
||||
assert self.calls[1].data["h"] == "40"
|
||||
assert self.calls[1].data["s"] == "50"
|
||||
assert self.calls[0].data["h"] == 40
|
||||
assert self.calls[0].data["s"] == 50
|
||||
assert self.calls[1].data["h"] == 40
|
||||
assert self.calls[1].data["s"] == 50
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"expected_hs,template",
|
||||
|
||||
@@ -867,7 +867,7 @@ async def test_self_referencing_entity_picture_loop(hass, caplog):
|
||||
|
||||
state = hass.states.get("sensor.test")
|
||||
assert int(state.state) == 1
|
||||
assert state.attributes[ATTR_ENTITY_PICTURE] == "2"
|
||||
assert state.attributes[ATTR_ENTITY_PICTURE] == 2
|
||||
|
||||
await hass.async_block_till_done()
|
||||
assert int(state.state) == 1
|
||||
|
||||
Reference in new issue
Block a user