async def test_process_event_substate(test_state, child_state, grandchild_state):
    """Test processing an event on a substate.

    Args:
        test_state: A state.
        child_state: A child state.
        grandchild_state: A grandchild state.
    """
    # Events should bubble down to the substate.
    assert child_state.value == ""
    assert child_state.count == 23
    event = Event(
        token="t",
        name=f"{ChildState.get_name()}.change_both",
        payload={"value": "hi", "count": 12},
    )
    async for update in test_state._process(event):
        assert child_state.value == "HI"
        assert child_state.count == 24
        assert update.delta == {
            # TestState.get_full_name(): {"sum": 3.14, "upper": ""},
            ChildState.get_full_name(): {"value": "HI", "count": 24},
            GrandchildState3.get_full_name(): {"computed": ""},
        }
        test_state._clean()

    # Test with the granchild state.
    assert grandchild_state.value2 == ""
    event = Event(
        token="t",
        name=f"{GrandchildState.get_full_name()}.set_value2",
        payload={"value": "new"},
    )
    async for update in test_state._process(event):
        assert grandchild_state.value2 == "new"
        assert update.delta == {
            # TestState.get_full_name(): {"sum": 3.14, "upper": ""},
            GrandchildState.get_full_name(): {"value2": "new"},
            GrandchildState3.get_full_name(): {"computed": ""},
        }
Test processing an event on a substate.

    Args:
        test_state: A state.
        child_state: A child state.
        grandchild_state: A grandchild state.
    
tests/units/test_state.py