feat: split to weather and gismeteo modules

This commit is contained in:
2024-07-26 11:02:01 +03:00
parent c9e52c43a9
commit 848b6bd9ba
28 changed files with 157 additions and 108 deletions

View File

@@ -1,10 +1,7 @@
import json
from pathlib import Path
from typing import List
import dateparser
from gismeteo.api import WeatherValue
from gismeteo.api import WeatherResponse
class MockData:
@@ -14,12 +11,9 @@ class MockData:
return (Path(__file__).parent / "data/weather.html").read_text()
@property
def values(self) -> List[WeatherValue]:
def response(self) -> WeatherResponse:
data = json.loads((Path(__file__).parent / "data/weather.json").read_text())
return [
WeatherValue(**{**item, "date": dateparser.parse(item["date"])})
for item in data
]
return WeatherResponse(**data)
MOCK_DATA = MockData()