e-data 2.0.0.dev125__tar.gz → 2.0.0.dev126__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {e_data-2.0.0.dev125/e_data.egg-info → e_data-2.0.0.dev126}/PKG-INFO +1 -1
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126/e_data.egg-info}/PKG-INFO +1 -1
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/services/data_service.py +3 -1
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/tests/test_services.py +21 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/pyproject.toml +1 -1
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/LICENSE +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/MANIFEST.in +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/README.md +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/e_data.egg-info/SOURCES.txt +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/e_data.egg-info/dependency_links.txt +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/e_data.egg-info/requires.txt +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/e_data.egg-info/top_level.txt +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/__init__.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/cli.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/core/__init__.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/core/const.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/core/utils.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/database/__init__.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/database/controller.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/database/models.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/database/queries.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/database/utils.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/models/__init__.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/models/bill.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/models/data.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/models/supply.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/providers/__init__.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/providers/datadis.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/providers/redata.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/services/bill_service.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/tests/__init__.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/tests/test_datadis_connector.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/edata/tests/test_redata_connector.py +0 -0
- {e_data-2.0.0.dev125 → e_data-2.0.0.dev126}/setup.cfg +0 -0
|
@@ -316,7 +316,9 @@ class DataService:
|
|
|
316
316
|
# end date out of bounds
|
|
317
317
|
return False
|
|
318
318
|
if _pvpc_dt := await self._get_last_pvpc_dt():
|
|
319
|
-
|
|
319
|
+
# keep within the fetchable window even if the last stored price is
|
|
320
|
+
# older than a month, otherwise REData rejects the range with a 400
|
|
321
|
+
start = max(_pvpc_dt + timedelta(hours=1), min_date)
|
|
320
322
|
if start >= end:
|
|
321
323
|
_LOGGER.info("%s pvpc prices are already synced", self._scups)
|
|
322
324
|
# data is already synced
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from datetime import datetime, timedelta
|
|
1
2
|
import json
|
|
2
3
|
import os
|
|
3
4
|
from tempfile import gettempdir
|
|
@@ -7,6 +8,7 @@ import pytest
|
|
|
7
8
|
import pytest_asyncio
|
|
8
9
|
from syrupy.assertion import SnapshotAssertion
|
|
9
10
|
|
|
11
|
+
from edata.core.utils import get_day
|
|
10
12
|
from edata.models.bill import BillingRules
|
|
11
13
|
from edata.models.data import Energy, Power
|
|
12
14
|
from edata.models.supply import Contract, Supply
|
|
@@ -211,3 +213,22 @@ async def test_clear_bills(populated_data_service, energy, storage_dir):
|
|
|
211
213
|
assert len(await bs.get_bills("hour")) == 0
|
|
212
214
|
assert len(await bs.get_bills(type_="day")) == 0
|
|
213
215
|
assert len(await bs.get_bills(type_="month")) == 0
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@pytest.mark.asyncio
|
|
219
|
+
async def test_update_pvpc_clamps_range_to_min_date(populated_data_service):
|
|
220
|
+
ds = populated_data_service
|
|
221
|
+
now = datetime.now()
|
|
222
|
+
stale_dt = now - timedelta(days=90)
|
|
223
|
+
|
|
224
|
+
with (
|
|
225
|
+
patch.object(ds, "_get_last_pvpc_dt", AsyncMock(return_value=stale_dt)),
|
|
226
|
+
patch.object(
|
|
227
|
+
ds.redata, "async_get_realtime_prices", AsyncMock(return_value=[])
|
|
228
|
+
) as mock_fetch,
|
|
229
|
+
):
|
|
230
|
+
await ds.update_pvpc(now - timedelta(days=365), now)
|
|
231
|
+
|
|
232
|
+
mock_fetch.assert_awaited_once()
|
|
233
|
+
called_start = mock_fetch.await_args.args[0]
|
|
234
|
+
assert called_start >= get_day(now) - timedelta(days=28)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|