Skip to content

Commit 88d47d5

Browse files
committed
Use the client Fuse types where appropriate
In the tests we are sometimes mocking the client, so we need to use the client `Fuse` type instead of our internal `Fuse` type (that uses quantities). Signed-off-by: Leandro Lucarella <[email protected]>
1 parent a602746 commit 88d47d5

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

tests/microgrid/test_graph.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,7 @@ async def test_refresh_from_api(self) -> None:
906906
servicer.set_connections([(101, 111), (111, 131)])
907907
await graph.refresh_from_api(client)
908908

909-
grid_max_current = Current.zero()
910-
grid_fuse = Fuse(grid_max_current)
909+
grid_fuse = Fuse(max_current=0.0)
911910

912911
# Note: we need to add GriMetadata as a dict here, because that's what
913912
# the ComponentGraph does too, and we need to be able to compare the

tests/microgrid/test_grid.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,14 @@ async def test_grid_1(mocker: MockerFixture) -> None:
4545
assert grid.fuse.max_current == Current.from_amperes(0.0)
4646

4747

48-
def _create_fuse() -> Fuse:
49-
"""Create a fuse with a fixed current.
50-
51-
Returns:
52-
Fuse: The fuse.
53-
"""
54-
fuse_current = Current.from_amperes(123.0)
55-
fuse = Fuse(fuse_current)
56-
return fuse
57-
58-
5948
async def test_grid_2(mocker: MockerFixture) -> None:
6049
"""Validate that microgrids with one grid connection are accepted."""
6150
components = {
6251
client.Component(
6352
1,
6453
client.ComponentCategory.GRID,
6554
None,
66-
client.GridMetadata(_create_fuse()),
55+
client.GridMetadata(client.Fuse(123.0)),
6756
),
6857
client.Component(2, client.ComponentCategory.METER),
6958
}

tests/timeseries/mock_microgrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__( # pylint: disable=too-many-arguments
6161
num_values: int = 2000,
6262
sample_rate_s: float = 0.01,
6363
num_namespaces: int = 1,
64-
fuse: Fuse | None = Fuse(Current.from_amperes(10_000.0)),
64+
fuse: Fuse | None = Fuse(10_000.0),
6565
graph: _MicrogridComponentGraph | None = None,
6666
mocker: MockerFixture | None = None,
6767
):

0 commit comments

Comments
 (0)