MCPcopy Create free account
hub / github.com/ccxt/ccxt / test_race_with_wait_for_timeout

Function test_race_with_wait_for_timeout

python/ccxt/pro/test/base/test_future.py:122–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120 future2.cancel()
121
122async def test_race_with_wait_for_timeout():
123 print("test_race_with_wait_for_timeout")
124 future1 = Future()
125
126 task = asyncio.create_task(resolve_later(future1, "completed first", 2))
127
128 # Attempt to race the futures with a timeout shorter than their resolution time
129 try:
130 race_future = Future.race([future1])
131 await asyncio.wait_for(race_future, timeout=1) # Timeout is set deliberately short
132 assert False, "Expected a timeout but race_future completed"
133 except asyncio.TimeoutError:
134 # Expected outcome, the race_future should not complete within the timeout
135 assert True
136 await task
137
138async def test_race_with_wait_for_completion():
139 print("test_race_with_wait_for_completion")

Callers 1

test_ws_futureFunction · 0.85

Calls 3

FutureClass · 0.90
resolve_laterFunction · 0.85
raceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…