diff --git a/tests/components/yr/test_sensor.py b/tests/components/yr/test_sensor.py index 21ce0bbe7ce..7e2e8543f77 100644 --- a/tests/components/yr/test_sensor.py +++ b/tests/components/yr/test_sensor.py @@ -1,5 +1,4 @@ """The tests for the Yr sensor platform.""" -import asyncio from datetime import datetime from unittest.mock import patch @@ -11,8 +10,7 @@ from tests.common import assert_setup_component, load_fixture NOW = datetime(2016, 6, 9, 1, tzinfo=dt_util.UTC) -@asyncio.coroutine -def test_default_setup(hass, aioclient_mock): +async def test_default_setup(hass, aioclient_mock): """Test the default setup.""" aioclient_mock.get( "https://aa015h6buqvih86i1.api.met.no/" "weatherapi/locationforecast/1.9/", @@ -23,7 +21,7 @@ def test_default_setup(hass, aioclient_mock): with patch( "homeassistant.components.yr.sensor.dt_util.utcnow", return_value=NOW ), assert_setup_component(1): - yield from async_setup_component(hass, "sensor", {"sensor": config}) + await async_setup_component(hass, "sensor", {"sensor": config}) state = hass.states.get("sensor.yr_symbol") @@ -31,8 +29,7 @@ def test_default_setup(hass, aioclient_mock): assert state.attributes.get("unit_of_measurement") is None -@asyncio.coroutine -def test_custom_setup(hass, aioclient_mock): +async def test_custom_setup(hass, aioclient_mock): """Test a custom setup.""" aioclient_mock.get( "https://aa015h6buqvih86i1.api.met.no/" "weatherapi/locationforecast/1.9/", @@ -54,7 +51,7 @@ def test_custom_setup(hass, aioclient_mock): with patch( "homeassistant.components.yr.sensor.dt_util.utcnow", return_value=NOW ), assert_setup_component(1): - yield from async_setup_component(hass, "sensor", {"sensor": config}) + await async_setup_component(hass, "sensor", {"sensor": config}) state = hass.states.get("sensor.yr_pressure") assert state.attributes.get("unit_of_measurement") == "hPa" @@ -77,8 +74,7 @@ def test_custom_setup(hass, aioclient_mock): assert state.state == "3.5" -@asyncio.coroutine -def test_forecast_setup(hass, aioclient_mock): +async def test_forecast_setup(hass, aioclient_mock): """Test a custom setup with 24h forecast.""" aioclient_mock.get( "https://aa015h6buqvih86i1.api.met.no/" "weatherapi/locationforecast/1.9/", @@ -101,7 +97,7 @@ def test_forecast_setup(hass, aioclient_mock): with patch( "homeassistant.components.yr.sensor.dt_util.utcnow", return_value=NOW ), assert_setup_component(1): - yield from async_setup_component(hass, "sensor", {"sensor": config}) + await async_setup_component(hass, "sensor", {"sensor": config}) state = hass.states.get("sensor.yr_pressure") assert state.attributes.get("unit_of_measurement") == "hPa"