async def test_deserialize_gc_state_disk(token):
    """Test that a state can be deserialized from disk with a grandchild state.

    Args:
        token: A token.
    """

    class Root(BaseState):
        pass

    class State(Root):
        num: int = 42

    class Child(State):
        foo: str = "bar"

    dsm = StateManagerDisk(state=Root)
    async with dsm.modify_state(token) as root:
        s = await root.get_state(State)
        s.num += 1
        c = await root.get_state(Child)
        assert s._get_was_touched()
        assert not c._get_was_touched()

    dsm2 = StateManagerDisk(state=Root)
    root = await dsm2.get_state(token)
    s = await root.get_state(State)
    assert s.num == 43
    c = await root.get_state(Child)
    assert c.foo == "bar"
Test that a state can be deserialized from disk with a grandchild state.

    Args:
        token: A token.
    
tests/units/test_state.py