async def test_get_state_tree(
    state_manager_redis,
    token,
    substate_cls,
    exp_root_substates,
    exp_root_dict_keys,
):
    """Test getting state trees and assert on which branches are retrieved.

    Args:
        state_manager_redis: The state manager redis fixture.
        token: The token fixture.
        substate_cls: The substate class to retrieve.
        exp_root_substates: The expected substates of the root state.
        exp_root_dict_keys: The expected keys of the root state dict.
    """
    state = await state_manager_redis.get_state(_substate_key(token, substate_cls))
    assert isinstance(state, Root)
    assert sorted(state.substates) == sorted(exp_root_substates)

    # Only computed vars should be returned
    assert state.get_delta() == ALWAYS_COMPUTED_VARS

    # All of TreeA, TreeD, and TreeE substates should be in the dict
    assert sorted(state.dict()) == sorted(exp_root_dict_keys)
Test getting state trees and assert on which branches are retrieved.

    Args:
        state_manager_redis: The state manager redis fixture.
        token: The token fixture.
        substate_cls: The substate class to retrieve.
        exp_root_substates: The expected substates of the root state.
        exp_root_dict_keys: The expected keys of the root state dict.
    
tests/units/test_state_tree.py