From 48a57d84408d66e7b2e0a147498a0c55002a3261 Mon Sep 17 00:00:00 2001 From: Andrey Khrolenok Date: Thu, 9 Feb 2023 01:38:07 +0300 Subject: [PATCH] Update code --- custom_components/snowtire/__init__.py | 3 +-- custom_components/snowtire/binary_sensor.py | 11 ++++++----- custom_components/snowtire/const.py | 3 +-- tests/test_binary_sensor.py | 22 ++++++++++----------- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/custom_components/snowtire/__init__.py b/custom_components/snowtire/__init__.py index be0fe0b..cdc112f 100644 --- a/custom_components/snowtire/__init__.py +++ b/custom_components/snowtire/__init__.py @@ -3,8 +3,7 @@ # Creative Commons BY-NC-SA 4.0 International Public License # (see LICENSE.md or https://creativecommons.org/licenses/by-nc-sa/4.0/) # -""" -The Snowtire binary sensor. +"""The Snowtire binary sensor. For more details about this platform, please refer to the documentation at https://github.com/Limych/ha-snowtire/ diff --git a/custom_components/snowtire/binary_sensor.py b/custom_components/snowtire/binary_sensor.py index cc330e1..02f96d4 100644 --- a/custom_components/snowtire/binary_sensor.py +++ b/custom_components/snowtire/binary_sensor.py @@ -3,17 +3,18 @@ # Creative Commons BY-NC-SA 4.0 International Public License # (see LICENSE.md or https://creativecommons.org/licenses/by-nc-sa/4.0/) # -""" -The Snowtire binary sensor. +"""The Snowtire binary sensor. For more details about this platform, please refer to the documentation at https://github.com/Limych/ha-snowtire/ """ -import logging +from collections.abc import Callable from datetime import datetime -from typing import Callable, Optional +import logging +from typing import Optional import voluptuous as vol + from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.components.weather import ( ATTR_FORECAST, @@ -21,8 +22,8 @@ ATTR_FORECAST_TEMP_LOW, ATTR_FORECAST_TIME, ATTR_WEATHER_TEMPERATURE, + DOMAIN as WEATHER, ) -from homeassistant.components.weather import DOMAIN as WEATHER from homeassistant.const import ( CONF_NAME, CONF_UNIQUE_ID, diff --git a/custom_components/snowtire/const.py b/custom_components/snowtire/const.py index 07965ea..c2b38cf 100644 --- a/custom_components/snowtire/const.py +++ b/custom_components/snowtire/const.py @@ -1,5 +1,4 @@ -""" -The Snowtire binary sensor. +"""The Snowtire binary sensor. For more details about this platform, please refer to the documentation at https://github.com/Limych/ha-snowtire/ diff --git a/tests/test_binary_sensor.py b/tests/test_binary_sensor.py index 9347ee3..b3c4d01 100644 --- a/tests/test_binary_sensor.py +++ b/tests/test_binary_sensor.py @@ -4,17 +4,6 @@ from unittest.mock import MagicMock import pytest -from homeassistant.components.weather import ( - ATTR_FORECAST, - ATTR_FORECAST_TEMP, - ATTR_FORECAST_TEMP_LOW, - ATTR_FORECAST_TIME, - ATTR_WEATHER_TEMPERATURE, -) -from homeassistant.const import CONF_PLATFORM, TEMP_CELSIUS, TEMP_FAHRENHEIT -from homeassistant.core import HomeAssistant -from homeassistant.exceptions import HomeAssistantError -from homeassistant.util import dt as dt_util from pytest import raises from custom_components.snowtire.binary_sensor import ( @@ -27,6 +16,17 @@ ICON_SUMMER, ICON_WINTER, ) +from homeassistant.components.weather import ( + ATTR_FORECAST, + ATTR_FORECAST_TEMP, + ATTR_FORECAST_TEMP_LOW, + ATTR_FORECAST_TIME, + ATTR_WEATHER_TEMPERATURE, +) +from homeassistant.const import CONF_PLATFORM, TEMP_CELSIUS, TEMP_FAHRENHEIT +from homeassistant.core import HomeAssistant +from homeassistant.exceptions import HomeAssistantError +from homeassistant.util import dt as dt_util MOCK_UNIQUE_ID: Final = "test_id" MOCK_NAME: Final = "test_name"