MCPcopy Create free account
hub / github.com/microsoft/playwright-python / assert_equal

Function assert_equal

tests/async/test_route_web_socket.py:24–39  ·  view source on GitHub ↗
(
    actual_cb: Callable[[], Union[Any, Awaitable[Any]]], expected: Any
)

Source from the content-addressed store, hash-verified

22
23
24async def assert_equal(
25 actual_cb: Callable[[], Union[Any, Awaitable[Any]]], expected: Any
26) -> None:
27 __tracebackhide__ = True
28 start_time = asyncio.get_event_loop().time()
29 attempts = 0
30 while True:
31 actual = actual_cb()
32 if asyncio.iscoroutine(actual):
33 actual = await actual
34 if actual == expected:
35 return
36 attempts += 1
37 if asyncio.get_event_loop().time() - start_time > 5:
38 raise TimeoutError(f"Timed out after 10 seconds. Last actual was: {actual}")
39 await asyncio.sleep(0.2)
40
41
42async def setup_ws(

Calls 1

TimeoutErrorClass · 0.85

Tested by

no test coverage detected