feat(app): add html weather view
This commit is contained in:
25
gismeteo/mock/__init__.py
Normal file
25
gismeteo/mock/__init__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
import dateparser
|
||||
|
||||
from gismeteo.api import WeatherValue
|
||||
|
||||
|
||||
class MockData:
|
||||
|
||||
@property
|
||||
def html(self) -> str:
|
||||
return (Path(__file__).parent / "data/weather.html").read_text()
|
||||
|
||||
@property
|
||||
def values(self) -> List[WeatherValue]:
|
||||
data = json.loads((Path(__file__).parent / "data/weather.json").read_text())
|
||||
return [
|
||||
WeatherValue(**{**item, "date": dateparser.parse(item["date"])})
|
||||
for item in data
|
||||
]
|
||||
|
||||
|
||||
MOCK_DATA = MockData()
|
||||
Reference in New Issue
Block a user