async def test_get_var_value(state_manager: StateManager, substate_token: str):
    """Test that get_var_value works correctly.

    Args:
        state_manager: The state manager to use.
        substate_token: Token for the substate used by state_manager.
    """
    state = await state_manager.get_state(substate_token)

    # State Var from same state
    assert await state.get_var_value(TestState.num1) == 0
    state.num1 = 42
    assert await state.get_var_value(TestState.num1) == 42

    # State Var from another state
    child_state = await state.get_state(ChildState)
    assert await state.get_var_value(ChildState.count) == 23
    child_state.count = 66
    assert await state.get_var_value(ChildState.count) == 66

    # LiteralVar with known value
    assert await state.get_var_value(rx.Var.create([1, 2, 3])) == [1, 2, 3]

    # Generic Var with no state
    with pytest.raises(UnretrievableVarValueError):
        await state.get_var_value(rx.Var("undefined"))

    # ObjectVar
    assert await state.get_var_value(TestState.mapping) == {
        "a": [1, 2, 3],
        "b": [4, 5, 6],
    }
Test that get_var_value works correctly.

    Args:
        state_manager: The state manager to use.
        substate_token: Token for the substate used by state_manager.
    
tests/units/test_state.py