def assert_code_snippets_run_in_sequence(snippets: list[tuple[str, int]], assume_import: bool):
    """Checks that a sequence of code snippets actually run.

    State is kept between snippets. Imports and variables defined in one
    snippet will be visible in later snippets.
    """

    state: dict[str, Any] = {}

    if assume_import:
        exec('import cirq', state)

    for content, line_number in snippets:
        assert_code_snippet_executes_correctly(content, state, line_number)
Checks that a sequence of code snippets actually run.

    State is kept between snippets. Imports and variables defined in one
    snippet will be visible in later snippets.
    
dev_tools/snippets_test.py