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
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue