From 8e09a94e3780d163408b8c0eb1aeb74733402001 Mon Sep 17 00:00:00 2001 From: Piotr Wegrzyn Date: Tue, 7 Jan 2025 00:44:14 +0100 Subject: [PATCH 1/2] Add `until_all_done` to `CallTrigger` --- transactron/testing/testbenchio.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/transactron/testing/testbenchio.py b/transactron/testing/testbenchio.py index 0553184..3538aaa 100644 --- a/transactron/testing/testbenchio.py +++ b/transactron/testing/testbenchio.py @@ -88,6 +88,11 @@ async def until_done(self) -> Any: if any(res is not None for res in results): return results + async def until_all_done(self) -> Any: + async for results in self: + if all(res is not None for res in results): + return results + def __await__(self) -> Generator: only_calls = [t for t in self.calls_and_values if isinstance(t, tuple)] only_values = [t for t in self.calls_and_values if not isinstance(t, tuple)] From e89d4ebf260c0eb867b2f12a8c354a1cadddc065 Mon Sep 17 00:00:00 2001 From: Piotr Wegrzyn Date: Tue, 7 Jan 2025 15:51:43 +0100 Subject: [PATCH 2/2] Add docstring --- transactron/testing/testbenchio.py | 1 + 1 file changed, 1 insertion(+) diff --git a/transactron/testing/testbenchio.py b/transactron/testing/testbenchio.py index 3538aaa..2a769cf 100644 --- a/transactron/testing/testbenchio.py +++ b/transactron/testing/testbenchio.py @@ -89,6 +89,7 @@ async def until_done(self) -> Any: return results async def until_all_done(self) -> Any: + """Same as `until_done` but wait for all results instead of any result.""" async for results in self: if all(res is not None for res in results): return results