mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-08-25 15:01:14 +00:00
Add API documentation generation and use Markdown (#160)
* Add package API documentation generation Add generation of the API documentation for akkudoktoreos and akkudoktoreosserver packages. The API documentation is generated by the Sphinx autosummary extension. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com> * Enable Google style source commenting and documentation generation. Enable automatic documentation generation from Google style docstrings in the source. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com> * Check Google style source commenting. Check Google style commenting by the appropriate ruff rules. Commenting is _NOT_ enforced. Missing docstrings are ignored. Minor commenting quirks of the code base are adapted. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com> * Improve Markdown handling and switch to Markdown documentation. Switch to Markdown for the documentation files to improve the user and developer experience (see issue #181). Keep files with special directives for automatic API documentation in RST format. The directives expect RST. Also add dummy handling for openai/ swagger server documentation. The openai interface definition is for now taken from the fastapi PR as EOS will switch to fastAPI. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com> --------- Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com> Co-authored-by: Normann <github@koldrack.com>
This commit is contained in:
@@ -14,9 +14,7 @@ start_hour = 1
|
||||
# Example initialization of necessary components
|
||||
@pytest.fixture
|
||||
def create_ems_instance():
|
||||
"""
|
||||
Fixture to create an EnergieManagementSystem instance with given test parameters.
|
||||
"""
|
||||
"""Fixture to create an EnergieManagementSystem instance with given test parameters."""
|
||||
# Initialize the battery and the inverter
|
||||
akku = PVAkku(kapazitaet_wh=5000, start_soc_prozent=80, hours=48, min_soc_prozent=10)
|
||||
akku.reset()
|
||||
@@ -204,9 +202,7 @@ def create_ems_instance():
|
||||
|
||||
|
||||
def test_simulation(create_ems_instance):
|
||||
"""
|
||||
Test the EnergieManagementSystem simulation method.
|
||||
"""
|
||||
"""Test the EnergieManagementSystem simulation method."""
|
||||
ems = create_ems_instance
|
||||
|
||||
# Simulate starting from hour 1 (this value can be adjusted)
|
||||
|
@@ -14,9 +14,7 @@ start_hour = 0
|
||||
# Example initialization of necessary components
|
||||
@pytest.fixture
|
||||
def create_ems_instance():
|
||||
"""
|
||||
Fixture to create an EnergieManagementSystem instance with given test parameters.
|
||||
"""
|
||||
"""Fixture to create an EnergieManagementSystem instance with given test parameters."""
|
||||
# Initialize the battery and the inverter
|
||||
akku = PVAkku(kapazitaet_wh=5000, start_soc_prozent=80, hours=48, min_soc_prozent=10)
|
||||
akku.reset()
|
||||
@@ -118,9 +116,7 @@ def create_ems_instance():
|
||||
|
||||
|
||||
def test_simulation(create_ems_instance):
|
||||
"""
|
||||
Test the EnergieManagementSystem simulation method.
|
||||
"""
|
||||
"""Test the EnergieManagementSystem simulation method."""
|
||||
ems = create_ems_instance
|
||||
|
||||
# Simulate starting from hour 0 (this value can be adjusted)
|
||||
|
@@ -5,13 +5,13 @@ from akkudoktoreos.heatpump import Heatpump
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def hp_5kw_24h() -> Heatpump:
|
||||
"""Heatpump with 5 kw heating power and 24 h prediction"""
|
||||
"""Heatpump with 5 kw heating power and 24 h prediction."""
|
||||
return Heatpump(5000, 24)
|
||||
|
||||
|
||||
class TestHeatpump:
|
||||
def test_cop(self, hp_5kw_24h: Heatpump):
|
||||
"""Testing calculate COP for variouse outside temperatures"""
|
||||
"""Testing calculate COP for variouse outside temperatures."""
|
||||
assert hp_5kw_24h.calculate_cop(-10) == 2.0
|
||||
assert hp_5kw_24h.calculate_cop(0) == 3.0
|
||||
assert hp_5kw_24h.calculate_cop(10) == 4.0
|
||||
@@ -24,13 +24,13 @@ class TestHeatpump:
|
||||
hp_5kw_24h.calculate_cop(out_temp_max)
|
||||
|
||||
def test_heating_output(self, hp_5kw_24h: Heatpump):
|
||||
"""Testing calculate of heating output"""
|
||||
"""Testing calculate of heating output."""
|
||||
assert hp_5kw_24h.calculate_heating_output(-10.0) == 5000
|
||||
assert hp_5kw_24h.calculate_heating_output(0.0) == 5000
|
||||
assert hp_5kw_24h.calculate_heating_output(10.0) == pytest.approx(4939.583)
|
||||
|
||||
def test_heating_power(self, hp_5kw_24h: Heatpump):
|
||||
"""Testing calculation of heating power"""
|
||||
"""Testing calculation of heating power."""
|
||||
assert hp_5kw_24h.calculate_heat_power(-10.0) == 2104
|
||||
assert hp_5kw_24h.calculate_heat_power(0.0) == 1164
|
||||
assert hp_5kw_24h.calculate_heat_power(10.0) == 548
|
||||
|
@@ -4,9 +4,7 @@ from akkudoktoreos.config import prediction_hours
|
||||
|
||||
|
||||
def test_server(server):
|
||||
"""
|
||||
Test the server
|
||||
"""
|
||||
"""Test the server."""
|
||||
result = requests.get(f"{server}/gesamtlast_simple?year_energy=2000&")
|
||||
assert result.status_code == 200
|
||||
assert len(result.json()) == prediction_hours
|
||||
|
Reference in New Issue
Block a user