Skip to content

Commit

Permalink
exluced normalize from national (#339)
Browse files Browse the repository at this point in the history
* exluced normalize from national

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* use model dump

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* noqa

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* change to different method

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* typing

* fix

* fix

* add Optional

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
peterdudfield and pre-commit-ci[bot] authored May 14, 2024
1 parent 8dde30a commit 539c62e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ class NationalForecastValue(ForecastValue):
None, description="Dictionary to hold properties of the forecast, like p_levels. "
)

expected_power_generation_normalized: Optional[float] = Field(
None,
ge=0,
description="exclude the normalized power",
exclude=True,
)

@validator("expected_power_generation_megawatts")
def result_check(cls, v):
"""Round to 2 decimal places"""
Expand Down
1 change: 1 addition & 0 deletions src/tests/test_national.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_read_latest_national_values(db_session, api_client):
national_forecast_values[24].plevels["plevel_10"]
!= national_forecast_values[0].expected_power_generation_megawatts * 0.9
)
assert "expected_power_generation_normalized" not in national_forecast_values[0].model_dump()


def test_read_latest_national_values_creation_limit(db_session, api_client):
Expand Down

0 comments on commit 539c62e

Please sign in to comment.