mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-08-25 15:01:14 +00:00
Structure code in logically separated submodules (#188)
This commit is contained in:
@@ -7,8 +7,8 @@ from time import sleep
|
||||
|
||||
import pytest
|
||||
|
||||
from akkudoktoreos.cachefilestore import CacheFileStore, cache_in_file
|
||||
from akkudoktoreos.datetimeutil import to_datetime
|
||||
from akkudoktoreos.utils.cachefilestore import CacheFileStore, cache_in_file
|
||||
from akkudoktoreos.utils.datetimeutil import to_datetime
|
||||
|
||||
# -----------------------------
|
||||
# CacheFileStore
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import unittest
|
||||
|
||||
from akkudoktoreos.class_akku import PVAkku, PVAkkuParameters
|
||||
from akkudoktoreos.devices.battery import PVAkku, PVAkkuParameters
|
||||
|
||||
|
||||
class TestPVAkku(unittest.TestCase):
|
||||
|
@@ -1,17 +1,14 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from akkudoktoreos.class_akku import EAutoParameters, PVAkku, PVAkkuParameters
|
||||
from akkudoktoreos.class_ems import (
|
||||
from akkudoktoreos.config import AppConfig
|
||||
from akkudoktoreos.devices.battery import EAutoParameters, PVAkku, PVAkkuParameters
|
||||
from akkudoktoreos.devices.generic import Haushaltsgeraet, HaushaltsgeraetParameters
|
||||
from akkudoktoreos.devices.inverter import Wechselrichter, WechselrichterParameters
|
||||
from akkudoktoreos.prediction.ems import (
|
||||
EnergieManagementSystem,
|
||||
EnergieManagementSystemParameters,
|
||||
)
|
||||
from akkudoktoreos.class_haushaltsgeraet import (
|
||||
Haushaltsgeraet,
|
||||
HaushaltsgeraetParameters,
|
||||
)
|
||||
from akkudoktoreos.class_inverter import Wechselrichter, WechselrichterParameters
|
||||
from akkudoktoreos.config import AppConfig
|
||||
|
||||
prediction_hours = 48
|
||||
optimization_hours = 24
|
||||
|
@@ -1,17 +1,14 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from akkudoktoreos.class_akku import EAutoParameters, PVAkku, PVAkkuParameters
|
||||
from akkudoktoreos.class_ems import (
|
||||
from akkudoktoreos.config import AppConfig
|
||||
from akkudoktoreos.devices.battery import EAutoParameters, PVAkku, PVAkkuParameters
|
||||
from akkudoktoreos.devices.generic import Haushaltsgeraet, HaushaltsgeraetParameters
|
||||
from akkudoktoreos.devices.inverter import Wechselrichter, WechselrichterParameters
|
||||
from akkudoktoreos.prediction.ems import (
|
||||
EnergieManagementSystem,
|
||||
EnergieManagementSystemParameters,
|
||||
)
|
||||
from akkudoktoreos.class_haushaltsgeraet import (
|
||||
Haushaltsgeraet,
|
||||
HaushaltsgeraetParameters,
|
||||
)
|
||||
from akkudoktoreos.class_inverter import Wechselrichter, WechselrichterParameters
|
||||
from akkudoktoreos.config import AppConfig
|
||||
|
||||
prediction_hours = 48
|
||||
optimization_hours = 24
|
||||
|
@@ -5,12 +5,12 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from akkudoktoreos.class_optimize import (
|
||||
from akkudoktoreos.config import AppConfig
|
||||
from akkudoktoreos.optimization.genetic import (
|
||||
OptimizationParameters,
|
||||
OptimizeResponse,
|
||||
optimization_problem,
|
||||
)
|
||||
from akkudoktoreos.config import AppConfig
|
||||
|
||||
DIR_TESTDATA = Path(__file__).parent / "testdata"
|
||||
|
||||
@@ -37,7 +37,7 @@ def compare_dict(actual: dict[str, Any], expected: dict[str, Any]):
|
||||
("optimize_input_2.json", "optimize_result_2_full.json", 400),
|
||||
],
|
||||
)
|
||||
@patch("akkudoktoreos.class_optimize.visualisiere_ergebnisse")
|
||||
@patch("akkudoktoreos.optimization.genetic.visualisiere_ergebnisse")
|
||||
def test_optimize(
|
||||
visualisiere_ergebnisse_patch,
|
||||
fn_in: str,
|
||||
@@ -65,7 +65,7 @@ def test_optimize(
|
||||
# Call the optimization function
|
||||
ergebnis = opt_class.optimierung_ems(parameters=input_data, start_hour=start_hour, ngen=ngen)
|
||||
# with open(f"new_{fn_out}", "w") as f_out:
|
||||
# from akkudoktoreos.class_numpy_encoder import NumpyEncoder
|
||||
# from akkudoktoreos.utils import NumpyEncoder
|
||||
# json_data_str = NumpyEncoder.dumps(ergebnis)
|
||||
# json.dump(json.loads(json_data_str), f_out, indent=4)
|
||||
|
||||
|
@@ -5,7 +5,7 @@ from zoneinfo import ZoneInfo
|
||||
|
||||
import pytest
|
||||
|
||||
from akkudoktoreos.datetimeutil import to_datetime, to_timedelta, to_timezone
|
||||
from akkudoktoreos.utils.datetimeutil import to_datetime, to_timedelta, to_timezone
|
||||
|
||||
# -----------------------------
|
||||
# to_datetime
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from akkudoktoreos.heatpump import Heatpump
|
||||
from akkudoktoreos.devices.heatpump import Heatpump
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
|
@@ -6,7 +6,7 @@ from logging.handlers import RotatingFileHandler
|
||||
|
||||
import pytest
|
||||
|
||||
from akkudoktoreos.logutil import get_logger
|
||||
from akkudoktoreos.utils.logutil import get_logger
|
||||
|
||||
# -----------------------------
|
||||
# get_logger
|
||||
|
@@ -1,7 +1,7 @@
|
||||
"""Test Module for PV Power Forecasting Module.
|
||||
|
||||
This test module is designed to verify the functionality of the `PVForecast` class
|
||||
and its methods in the `class_pv_forecast` module. The tests include validation for
|
||||
and its methods in the `prediction.pv_forecast` module. The tests include validation for
|
||||
forecast data processing, updating AC power measurements, retrieving forecast data,
|
||||
and caching behavior.
|
||||
|
||||
@@ -19,7 +19,7 @@ Test Cases:
|
||||
- test_cache_loading: Tests loading forecast data from a cached file to ensure caching works as expected.
|
||||
|
||||
Usage:
|
||||
This test module uses `pytest` and requires the `akkudoktoreos.class_pv_forecast.py` module to be present.
|
||||
This test module uses `pytest` and requires the `akkudoktoreos.prediction.pv_forecast.py` module to be present.
|
||||
Run the tests using the command: `pytest test_pv_forecast.py`.
|
||||
|
||||
"""
|
||||
@@ -31,8 +31,8 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from akkudoktoreos.class_pv_forecast import PVForecast, validate_pv_forecast_data
|
||||
from akkudoktoreos.datetimeutil import to_datetime
|
||||
from akkudoktoreos.prediction.pv_forecast import PVForecast, validate_pv_forecast_data
|
||||
from akkudoktoreos.utils.datetimeutil import to_datetime
|
||||
|
||||
DIR_TESTDATA = Path(__file__).absolute().parent.joinpath("testdata")
|
||||
|
||||
|
Reference in New Issue
Block a user