Skip to content

Commit

Permalink
Update test_binary_sensor.py to verify the entity_id
Browse files Browse the repository at this point in the history
  • Loading branch information
paolog89 committed Feb 8, 2020
1 parent 2fe21f0 commit 2b732f1
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions tests/components/bayesian/test_binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,8 @@ def test_sensor_numeric_state(self):

state = self.hass.states.get("binary_sensor.test_binary")
assert [
{"prob_false": 0.4, "prob_true": 0.6, "entity_id": "sensor.test_monitored"},
{
"prob_false": 0.1,
"prob_true": 0.9,
"entity_id": "sensor.test_monitored1",
},
"sensor.test_monitored",
"sensor.test_monitored1",
] == state.attributes.get("observations")
assert round(abs(0.77 - state.attributes.get("probability")), 7) == 0

Expand Down Expand Up @@ -135,9 +131,7 @@ def test_sensor_state(self):
self.hass.block_till_done()

state = self.hass.states.get("binary_sensor.test_binary")
assert [
{"prob_true": 0.8, "prob_false": 0.4, "entity_id": "sensor.test_monitored"}
] == state.attributes.get("observations")
assert ["sensor.test_monitored"] == state.attributes.get("observations")
assert round(abs(0.33 - state.attributes.get("probability")), 7) == 0

assert state.state == "on"
Expand Down Expand Up @@ -227,9 +221,7 @@ def test_multiple_observations(self):
self.hass.block_till_done()

state = self.hass.states.get("binary_sensor.test_binary")
assert [
{"prob_true": 0.8, "prob_false": 0.4, "entity_id": "sensor.test_monitored"}
] == state.attributes.get("observations")
assert ["sensor.test_monitored"] == state.attributes.get("observations")
assert round(abs(0.33 - state.attributes.get("probability")), 7) == 0

assert state.state == "on"
Expand Down

0 comments on commit 2b732f1

Please sign in to comment.