Skip to content

Commit

Permalink
fix: set_regularity fixture (#213)
Browse files Browse the repository at this point in the history
Set regularity should not raise error when value is wrong, and I think
we need to raise ValueError for pydantic to pick it up correctly, if we
wanted to raise an error.
  • Loading branch information
jsolaas authored Sep 28, 2023
1 parent 892720e commit e9ea04f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libecalc/common/utils/rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,9 @@ def set_regularity(cls, regularity: Optional[List[float]], values: Dict[str, Any
return regularity
try:
return [1] * len(values["values"])
except KeyError as e:
raise KeyError("Failed to set default values for regularity. 'Values' of timeseries is not defined") from e
except KeyError:
# 'Values' of timeseries is not defined. Not this validators responsibility.
return []

def __add__(self, other: TimeSeriesRate) -> TimeSeriesRate:
# Check for same unit
Expand Down

0 comments on commit e9ea04f

Please sign in to comment.