Test getting the substate of a state. Args: test_state: A state. child_state: A child state. child_state2: A child state. grandchild_state: A grandchild state.
(test_state, child_state, child_state2, grandchild_state)
| 689 | |
| 690 | |
| 691 | def test_get_substate(test_state, child_state, child_state2, grandchild_state): |
| 692 | """Test getting the substate of a state. |
| 693 | |
| 694 | Args: |
| 695 | test_state: A state. |
| 696 | child_state: A child state. |
| 697 | child_state2: A child state. |
| 698 | grandchild_state: A grandchild state. |
| 699 | """ |
| 700 | assert test_state.get_substate((ChildState.get_name(),)) == child_state |
| 701 | assert test_state.get_substate((ChildState2.get_name(),)) == child_state2 |
| 702 | assert ( |
| 703 | test_state.get_substate((ChildState.get_name(), GrandchildState.get_name())) |
| 704 | == grandchild_state |
| 705 | ) |
| 706 | assert child_state.get_substate((GrandchildState.get_name(),)) == grandchild_state |
| 707 | with pytest.raises(ValueError): |
| 708 | test_state.get_substate(("invalid",)) |
| 709 | with pytest.raises(ValueError): |
| 710 | test_state.get_substate((ChildState.get_name(), "invalid")) |
| 711 | with pytest.raises(ValueError): |
| 712 | test_state.get_substate(( |
| 713 | ChildState.get_name(), |
| 714 | GrandchildState.get_name(), |
| 715 | "invalid", |
| 716 | )) |
| 717 | |
| 718 | |
| 719 | def test_set_dirty_var(test_state): |
nothing calls this directly
no test coverage detected