MCPcopy
hub / github.com/marimo-team/marimo / try_assert_n_times

Function try_assert_n_times

tests/utils.py:19–32  ·  view source on GitHub ↗

Attempt an assert multiple times. Sleeps between each attempt.

(n: int, assert_fn: Callable[[], None])

Source from the content-addressed store, hash-verified

17
18
19def try_assert_n_times(n: int, assert_fn: Callable[[], None]) -> None:
20 """Attempt an assert multiple times.
21
22 Sleeps between each attempt.
23 """
24 n_tries = 0
25 while n_tries <= n - 1:
26 try:
27 assert_fn()
28 return
29 except Exception:
30 n_tries += 1
31 time.sleep(0.1)
32 assert_fn()
33
34
35def assert_serialize_roundtrip(obj: msgspec.Struct) -> None:

Callers 9

test_renameFunction · 0.90
test_save_fileFunction · 0.90
test_save_with_headerFunction · 0.90
test_save_app_configFunction · 0.90
test_copy_fileFunction · 0.90

Calls

no outgoing calls

Tested by 9

test_renameFunction · 0.72
test_save_fileFunction · 0.72
test_save_with_headerFunction · 0.72
test_save_app_configFunction · 0.72
test_copy_fileFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…