chore: update tests to adaped to new structure
This commit is contained in:
parent
d87d0cce11
commit
ee8f54cf06
8 changed files with 128 additions and 0 deletions
20
tests/test_smard.py
Normal file
20
tests/test_smard.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import polars as pl
|
||||
import requests_mock
|
||||
from collectors.smard import fetch_smard_data
|
||||
|
||||
def test_fetch_smard_data():
|
||||
with requests_mock.Mocker() as m:
|
||||
# Mock index call
|
||||
m.get("https://www.smard.de/app/chart_data/4169/DE-LU/index_hour.json",
|
||||
json={"timestamps": [1700000000000]})
|
||||
# Mock data call
|
||||
m.get("https://www.smard.de/app/chart_data/4169/DE-LU/4169_DE-LU_hour_1700000000000.json",
|
||||
json={
|
||||
"series": [[1700000000000, 50.0], [1700003600000, 60.0]]
|
||||
})
|
||||
|
||||
df = fetch_smard_data(filter_id=4169)
|
||||
assert isinstance(df, pl.DataFrame)
|
||||
assert df.shape == (2, 2)
|
||||
assert "value" in df.columns
|
||||
assert df["value"][0] == 50.0
|
||||
Loading…
Add table
Add a link
Reference in a new issue