Skip to content

Commit 133d521

Browse files
committed
Use FloatInt in PowerTransformer
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
1 parent 1364bfc commit 133d521

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/frequenz/client/common/microgrid/electrical_components/_power_transformer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import dataclasses
77

8+
from ..._float import FloatInt
89
from ._electrical_component import ElectricalComponent
910

1011

@@ -22,13 +23,13 @@ class PowerTransformer(ElectricalComponent):
2223
than the input power.
2324
"""
2425

25-
primary_voltage: float
26+
primary_voltage: FloatInt
2627
"""The primary voltage of the transformer, in volts.
2728
2829
This is the input voltage that is stepped up or down.
2930
"""
3031

31-
secondary_voltage: float
32+
secondary_voltage: FloatInt
3233
"""The secondary voltage of the transformer, in volts.
3334
3435
This is the output voltage that is the result of stepping the primary

tests/microgrid/electrical_components/test_power_transformer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import pytest
77

8+
from frequenz.client.common import FloatInt
89
from frequenz.client.common.microgrid import MicrogridId
910
from frequenz.client.common.microgrid.electrical_components import (
1011
ElectricalComponentId,
@@ -25,13 +26,14 @@ def microgrid_id() -> MicrogridId:
2526

2627

2728
@pytest.mark.parametrize(
28-
"primary, secondary", [(400.0, 230.0), (0.0, 0.0), (230.0, 400.0), (-230.0, -400.0)]
29+
"primary, secondary",
30+
[(400.0, 230.0), (0.0, 0.0), (230.0, 400.0), (-230.0, -400.0), (400, 230)],
2931
)
3032
def test_creation_ok(
3133
component_id: ElectricalComponentId,
3234
microgrid_id: MicrogridId,
33-
primary: float,
34-
secondary: float,
35+
primary: FloatInt,
36+
secondary: FloatInt,
3537
) -> None:
3638
"""Test PowerTransformer component initialization with different voltages."""
3739
power_transformer = PowerTransformer(

0 commit comments

Comments
 (0)