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:
Paulus Schoutsen 2018-10-24 12:10:05 +02:00 committed by GitHub
parent 4222f7562b
commit 08fe7c3ece
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
223 changed files with 6747 additions and 7237 deletions

View file

@ -37,11 +37,11 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
command_line.setup_platform(self.hass, config, add_dev_callback)
self.assertEqual(1, len(devices))
assert 1 == len(devices)
entity = devices[0]
entity.update()
self.assertEqual('Test', entity.name)
self.assertEqual(STATE_ON, entity.state)
assert 'Test' == entity.name
assert STATE_ON == entity.state
def test_template(self):
"""Test setting the state with a template."""
@ -51,7 +51,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
self.hass, data, 'test', None, '1.0', '0',
template.Template('{{ value | multiply(0.1) }}', self.hass))
entity.update()
self.assertEqual(STATE_ON, entity.state)
assert STATE_ON == entity.state
def test_sensor_off(self):
"""Test setting the state with a template."""
@ -60,4 +60,4 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
entity = command_line.CommandBinarySensor(
self.hass, data, 'test', None, '1', '0', None)
entity.update()
self.assertEqual(STATE_OFF, entity.state)
assert STATE_OFF == entity.state