ci(action): add test and build actions
test / test (push) Successful in 45s

This commit is contained in:
2026-09-24 12:11:08 +03:00
parent 829a12612e
commit f3b831649e
6 changed files with 231 additions and 8 deletions
+1 -5
View File
@@ -1,8 +1,6 @@
import datetime
from os import environ
from fastapi import HTTPException, status
from gallery.sketch.source import ApiSource
from gallery.sketch.weather.api import WeatherApi
from gallery.sketch.weather.model import Location, WeatherResponse
@@ -46,9 +44,7 @@ class GismeteoApi(WeatherApi):
async def get_day(self, location_id: str, date: datetime.date) -> WeatherResponse:
max_date = datetime.date.today() + datetime.timedelta(days=9)
if date > max_date:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST, detail={"max_date": max_date.strftime("%Y-%m-%d")}
)
raise ValueError(f"Invalid date: {date}, max: {max_date}")
data = await self.source.request(f"weather-{location_id}/{format_date(date)}")
context = ForecastData(date, "day", data, 8)
return self.forecast_parser.parse(context)