Pytest tests (#17750)
* Convert core tests
* Convert component tests to use pytest assert
* Lint 🤷♂️
* Fix test
* Fix 3 typos in docs
This commit is contained in:
parent
4222f7562b
commit
08fe7c3ece
223 changed files with 6747 additions and 7237 deletions
|
@ -47,7 +47,7 @@ class TestComponentHistory(unittest.TestCase):
|
|||
history.CONF_DOMAINS: ['thermostat'],
|
||||
history.CONF_ENTITIES: ['media_player.test']}}})
|
||||
self.init_recorder()
|
||||
self.assertTrue(setup_component(self.hass, history.DOMAIN, config))
|
||||
assert setup_component(self.hass, history.DOMAIN, config)
|
||||
|
||||
def test_get_states(self):
|
||||
"""Test getting states at a specific point in time."""
|
||||
|
@ -89,9 +89,8 @@ class TestComponentHistory(unittest.TestCase):
|
|||
assert state1 == state2
|
||||
|
||||
# Test get_state here because we have a DB setup
|
||||
self.assertEqual(
|
||||
states[0], history.get_state(self.hass, future,
|
||||
states[0].entity_id))
|
||||
assert states[0] == \
|
||||
history.get_state(self.hass, future, states[0].entity_id)
|
||||
|
||||
def test_state_changes_during_period(self):
|
||||
"""Test state change during period."""
|
||||
|
@ -130,7 +129,7 @@ class TestComponentHistory(unittest.TestCase):
|
|||
hist = history.state_changes_during_period(
|
||||
self.hass, start, end, entity_id)
|
||||
|
||||
self.assertEqual(states, hist[entity_id])
|
||||
assert states == hist[entity_id]
|
||||
|
||||
def test_get_last_state_changes(self):
|
||||
"""Test number of state changes."""
|
||||
|
@ -163,7 +162,7 @@ class TestComponentHistory(unittest.TestCase):
|
|||
hist = history.get_last_state_changes(
|
||||
self.hass, 2, entity_id)
|
||||
|
||||
self.assertEqual(states, hist[entity_id])
|
||||
assert states == hist[entity_id]
|
||||
|
||||
def test_get_significant_states(self):
|
||||
"""Test that only significant states are returned.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue