MCPcopy
hub / github.com/reflex-dev/reflex / test_nested_async_with_self

Function test_nested_async_with_self

tests/integration/test_background_task.py:342–368  ·  view source on GitHub ↗

Test that nested async with self in the same coroutine raises Exception. Args: background_task: harness for BackgroundTask app. driver: WebDriver instance. token: The token for the connected client.

(
    background_task: AppHarness,
    driver: WebDriver,
    token: str,
)

Source from the content-addressed store, hash-verified

340
341
342def test_nested_async_with_self(
343 background_task: AppHarness,
344 driver: WebDriver,
345 token: str,
346):
347 """Test that nested async with self in the same coroutine raises Exception.
348
349 Args:
350 background_task: harness for BackgroundTask app.
351 driver: WebDriver instance.
352 token: The token for the connected client.
353 """
354 assert background_task.app_instance is not None
355
356 # get a reference to all buttons
357 nested_async_with_self_button = driver.find_element(By.ID, "nested-async-with-self")
358 increment_button = driver.find_element(By.ID, "increment")
359
360 # get a reference to the counter
361 counter = driver.find_element(By.ID, "counter")
362 AppHarness.expect(lambda: counter.text == "0", timeout=5)
363
364 nested_async_with_self_button.click()
365 AppHarness.expect(lambda: counter.text == "1", timeout=5)
366
367 increment_button.click()
368 AppHarness.expect(lambda: counter.text == "2", timeout=5)
369
370
371def test_get_state(

Callers

nothing calls this directly

Calls 1

expectMethod · 0.80

Tested by

no test coverage detected