Skip to content

Commit d80afd6

Browse files
committed
Test: Make assert more verbose
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent cef414d commit d80afd6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/test_client.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import random
88
from dataclasses import replace
99
from datetime import timedelta
10+
from functools import partial
1011

1112
import grpc
1213
from pytest import raises
@@ -98,7 +99,16 @@ async def test_list_dispatches(
9899
dispatches = client.list(microgrid_id=1)
99100
async for page in dispatches:
100101
for dispatch in page:
101-
assert dispatch in client.dispatches(microgrid_id=1)
102+
# First find matching id in client.dispatches, then compare
103+
service_side_dispatch = next(
104+
filter(
105+
partial(lambda d, md: d.id == md.id, md=dispatch),
106+
client.dispatches(microgrid_id=1),
107+
),
108+
None,
109+
)
110+
111+
assert dispatch == service_side_dispatch
102112

103113

104114
async def test_list_dispatches_no_duration(

0 commit comments

Comments
 (0)