mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Correct checks for deprecated forecast in weather (#101392)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
@@ -125,11 +125,6 @@ class MockWeather(MockEntity, WeatherEntity):
|
||||
"""Return the unit of measurement for visibility."""
|
||||
return self._handle("native_visibility_unit")
|
||||
|
||||
@property
|
||||
def forecast(self) -> list[Forecast] | None:
|
||||
"""Return the forecast."""
|
||||
return self._handle("forecast")
|
||||
|
||||
@property
|
||||
def native_precipitation_unit(self) -> str | None:
|
||||
"""Return the native unit of measurement for accumulated precipitation."""
|
||||
@@ -291,34 +286,3 @@ class MockWeatherMockForecast(MockWeather):
|
||||
ATTR_FORECAST_HUMIDITY: self.humidity,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
class MockWeatherMockLegacyForecastOnly(MockWeather):
|
||||
"""Mock weather class with mocked legacy forecast."""
|
||||
|
||||
def __init__(self, **values: Any) -> None:
|
||||
"""Initialize."""
|
||||
super().__init__(**values)
|
||||
self.forecast_list: list[Forecast] | None = [
|
||||
{
|
||||
ATTR_FORECAST_NATIVE_TEMP: self.native_temperature,
|
||||
ATTR_FORECAST_NATIVE_APPARENT_TEMP: self.native_apparent_temperature,
|
||||
ATTR_FORECAST_NATIVE_TEMP_LOW: self.native_temperature,
|
||||
ATTR_FORECAST_NATIVE_DEW_POINT: self.native_dew_point,
|
||||
ATTR_FORECAST_CLOUD_COVERAGE: self.cloud_coverage,
|
||||
ATTR_FORECAST_NATIVE_PRESSURE: self.native_pressure,
|
||||
ATTR_FORECAST_NATIVE_WIND_GUST_SPEED: self.native_wind_gust_speed,
|
||||
ATTR_FORECAST_NATIVE_WIND_SPEED: self.native_wind_speed,
|
||||
ATTR_FORECAST_WIND_BEARING: self.wind_bearing,
|
||||
ATTR_FORECAST_UV_INDEX: self.uv_index,
|
||||
ATTR_FORECAST_NATIVE_PRECIPITATION: self._values.get(
|
||||
"native_precipitation"
|
||||
),
|
||||
ATTR_FORECAST_HUMIDITY: self.humidity,
|
||||
}
|
||||
]
|
||||
|
||||
@property
|
||||
def forecast(self) -> list[Forecast] | None:
|
||||
"""Return the forecast."""
|
||||
return self.forecast_list
|
||||
|
||||
Reference in New Issue
Block a user