1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

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
223 changed files with 6747 additions and 7237 deletions

View File

@@ -12,7 +12,7 @@ class TestHelpersLocation(unittest.TestCase):
def test_has_location_with_invalid_states(self):
"""Set up the tests."""
for state in (None, 1, "hello", object):
self.assertFalse(location.has_location(state))
assert not location.has_location(state)
def test_has_location_with_states_with_invalid_locations(self):
"""Set up the tests."""
@@ -20,7 +20,7 @@ class TestHelpersLocation(unittest.TestCase):
ATTR_LATITUDE: 'no number',
ATTR_LONGITUDE: 123.12
})
self.assertFalse(location.has_location(state))
assert not location.has_location(state)
def test_has_location_with_states_with_valid_location(self):
"""Set up the tests."""
@@ -28,7 +28,7 @@ class TestHelpersLocation(unittest.TestCase):
ATTR_LATITUDE: 123.12,
ATTR_LONGITUDE: 123.12
})
self.assertTrue(location.has_location(state))
assert location.has_location(state)
def test_closest_with_no_states_with_location(self):
"""Set up the tests."""
@@ -41,8 +41,8 @@ class TestHelpersLocation(unittest.TestCase):
ATTR_LONGITUDE: 123.45,
})
self.assertIsNone(
location.closest(123.45, 123.45, [state, state2, state3]))
assert \
location.closest(123.45, 123.45, [state, state2, state3]) is None
def test_closest_returns_closest(self):
"""Test ."""
@@ -55,5 +55,4 @@ class TestHelpersLocation(unittest.TestCase):
ATTR_LONGITUDE: 125.45,
})
self.assertEqual(
state, location.closest(123.45, 123.45, [state, state2]))
assert state == location.closest(123.45, 123.45, [state, state2])