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.
(
state_manager_redis,
token,
substate_cls,
exp_root_substates,
exp_root_dict_keys,
)
| 358 | ], |
| 359 | ) |
| 360 | async def test_get_state_tree( |
| 361 | state_manager_redis, |
| 362 | token, |
| 363 | substate_cls, |
| 364 | exp_root_substates, |
| 365 | exp_root_dict_keys, |
| 366 | ): |
| 367 | """Test getting state trees and assert on which branches are retrieved. |
| 368 | |
| 369 | Args: |
| 370 | state_manager_redis: The state manager redis fixture. |
| 371 | token: The token fixture. |
| 372 | substate_cls: The substate class to retrieve. |
| 373 | exp_root_substates: The expected substates of the root state. |
| 374 | exp_root_dict_keys: The expected keys of the root state dict. |
| 375 | """ |
| 376 | state = await state_manager_redis.get_state( |
| 377 | BaseStateToken(ident=token, cls=substate_cls) |
| 378 | ) |
| 379 | assert isinstance(state, Root) |
| 380 | assert sorted(state.substates) == sorted(exp_root_substates) |
| 381 | |
| 382 | # Only computed vars should be returned |
| 383 | assert state.get_delta() == ALWAYS_COMPUTED_VARS |
| 384 | |
| 385 | # All of TreeA, TreeD, and TreeE substates should be in the dict |
| 386 | assert sorted(state.dict()) == sorted(exp_root_dict_keys) |
nothing calls this directly
no test coverage detected