Skip to content

Commit

Permalink
Add overrides to sub-classes
Browse files Browse the repository at this point in the history
Signed-off-by: Leandro Lucarella <[email protected]>
  • Loading branch information
llucax committed Feb 28, 2024
1 parent 4282adf commit 1e1541f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/mock_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from google.protobuf.wrappers_pb2 import BoolValue

# pylint: enable=no-name-in-module
from typing_extensions import override


class MockMicrogridServicer( # pylint: disable=too-many-public-methods
Expand Down Expand Up @@ -152,6 +153,7 @@ def clear_bounds(self) -> None:
"""Drop all received bounds."""
self._bounds.clear()

@override
def ListComponents( # pylint: disable=unused-argument
self,
request: ComponentFilter,
Expand All @@ -160,6 +162,7 @@ def ListComponents( # pylint: disable=unused-argument
"""List components."""
return ComponentList(components=self._components)

@override
def ListConnections(
self, request: ConnectionFilter, context: grpc.ServicerContext
) -> ConnectionList:
Expand All @@ -171,6 +174,7 @@ def ListConnections(
connections = filter(lambda c: c.end in request.ends, connections)
return ConnectionList(connections=connections)

@override
def StreamComponentData(
self, request: ComponentIdParam, context: grpc.ServicerContext
) -> Iterator[ComponentData]:
Expand Down Expand Up @@ -214,66 +218,77 @@ def next_msg() -> ComponentData:
msg = next_msg()
yield msg

@override
def SetPowerActive(
self, request: SetPowerActiveParam, context: grpc.ServicerContext
) -> Empty:
"""Microgrid service SetPowerActive method stub."""
self._latest_power = request
return Empty()

@override
def SetPowerReactive(
self, request: SetPowerReactiveParam, context: grpc.ServicerContext
) -> Empty:
"""Microgrid service SetPowerReactive method stub."""
return Empty()

@override
def GetMicrogridMetadata(
self, request: Empty, context: grpc.ServicerContext
) -> MicrogridMetadata:
"""Microgrid service GetMicrogridMetadata method stub."""
return MicrogridMetadata()

@override
def CanStreamData(
self, request: ComponentIdParam, context: grpc.ServicerContext
) -> BoolValue:
"""Microgrid service CanStreamData method stub."""
return BoolValue(value=True)

@override
def AddExclusionBounds(
self, request: SetBoundsParam, context: grpc.ServicerContext
) -> Timestamp:
"""Microgrid service AddExclusionBounds method stub."""
return Timestamp()

@override
def AddInclusionBounds(
self, request: SetBoundsParam, context: grpc.ServicerContext
) -> Timestamp:
"""Microgrid service AddExclusionBounds method stub."""
self._bounds.append(request)
return Timestamp()

@override
def HotStandby(
self, request: ComponentIdParam, context: grpc.ServicerContext
) -> Empty:
"""Microgrid service HotStandby method stub."""
return Empty()

@override
def ColdStandby(
self, request: ComponentIdParam, context: grpc.ServicerContext
) -> Empty:
"""Microgrid service ColdStandby method stub."""
return Empty()

@override
def ErrorAck(
self, request: ComponentIdParam, context: grpc.ServicerContext
) -> Empty:
"""Microgrid service ErrorAck method stub."""
return Empty()

@override
def Start(self, request: ComponentIdParam, context: grpc.ServicerContext) -> Empty:
"""Microgrid service Start method stub."""
return Empty()

@override
def Stop(self, request: ComponentIdParam, context: grpc.ServicerContext) -> Empty:
"""Microgrid service Stop method stub."""
return Empty()
Expand Down

0 comments on commit 1e1541f

Please sign in to comment.