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

Function test_initialize_with_state

tests/units/test_app.py:469–486  ·  view source on GitHub ↗

Test setting the state of an app. Args: test_state: The default state. token: a Token.

(test_state: type[ATestState], token: str)

Source from the content-addressed store, hash-verified

467
468@pytest.mark.asyncio
469async def test_initialize_with_state(test_state: type[ATestState], token: str):
470 """Test setting the state of an app.
471
472 Args:
473 test_state: The default state.
474 token: a Token.
475 """
476 app = App(_state=test_state)
477 assert app._state == test_state
478
479 # Get a state for a given token.
480 state = await app.state_manager.get_state(
481 BaseStateToken(ident=token, cls=test_state)
482 )
483 assert isinstance(state, test_state)
484 assert state.var == 0
485
486 await app.state_manager.close()
487
488
489@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 4

AppClass · 0.90
BaseStateTokenClass · 0.90
get_stateMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected