feat: split to weather and gismeteo modules
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user