File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 22# Copyright © 2022 Frequenz Energy-as-a-Service GmbH
33
44"""Setup for all the tests."""
5- import collections .abc
65import contextlib
6+ from collections .abc import Iterator
77from datetime import timedelta
88
99import pytest
1616
1717
1818@contextlib .contextmanager
19- def actor_restart_limit (limit : int ) -> collections . abc . Iterator [None ]:
19+ def actor_restart_limit (limit : int ) -> Iterator [None ]:
2020 """Temporarily set the actor restart limit to a given value.
2121
2222 Example:
@@ -41,14 +41,14 @@ def actor_restart_limit(limit: int) -> collections.abc.Iterator[None]:
4141
4242
4343@pytest .fixture (scope = "session" , autouse = True )
44- def disable_actor_auto_restart () -> collections . abc . Iterator [None ]:
44+ def disable_actor_auto_restart () -> Iterator [None ]:
4545 """Disable auto-restart of actors while running tests."""
4646 with actor_restart_limit (0 ):
4747 yield
4848
4949
5050@pytest .fixture
51- def actor_auto_restart_once () -> collections . abc . Iterator [None ]:
51+ def actor_auto_restart_once () -> Iterator [None ]:
5252 """Make actors restart only once."""
5353 with actor_restart_limit (1 ):
5454 yield
Original file line number Diff line number Diff line change 33
44"""Tests for the timeseries averager."""
55
6- import collections .abc
76import contextlib
7+ from collections .abc import AsyncIterator
88from datetime import datetime , timedelta , timezone
99from typing import List
1010
2828@contextlib .asynccontextmanager
2929async def init_feature_extractor (
3030 data : List [float ], period : timedelta
31- ) -> collections . abc . AsyncIterator [PeriodicFeatureExtractor ]:
31+ ) -> AsyncIterator [PeriodicFeatureExtractor ]:
3232 """
3333 Initialize a PeriodicFeatureExtractor with a `MovingWindow` that contains the data.
3434
3535 Args:
3636 data: The data that is pushed into the moving window.
3737 period: The distance between two successive windows.
3838
39- Returns :
39+ Yields :
4040 PeriodicFeatureExtractor
4141 """
4242 window , sender = init_moving_window (timedelta (seconds = len (data )))
@@ -48,14 +48,14 @@ async def init_feature_extractor(
4848@contextlib .asynccontextmanager
4949async def init_feature_extractor_no_data (
5050 period : int ,
51- ) -> collections . abc . AsyncIterator [PeriodicFeatureExtractor ]:
51+ ) -> AsyncIterator [PeriodicFeatureExtractor ]:
5252 """
5353 Initialize a PeriodicFeatureExtractor with a `MovingWindow` that contains no data.
5454
5555 Args:
5656 period: The distance between two successive windows.
5757
58- Returns :
58+ Yields :
5959 PeriodicFeatureExtractor
6060 """
6161 # We only need the moving window to initialize the PeriodicFeatureExtractor class.
You can’t perform that action at this time.
0 commit comments