def assert_has_rendering(actual: TextDiagramDrawer, desired: str, **kwargs) -> None:
    """Determines if a given diagram has the desired rendering.

    Args:
        actual: The text diagram.
        desired: The desired rendering as a string.
        **kwargs: Keyword arguments to be passed to actual.render.
    """
    actual_diagram = actual.render(**kwargs)
    desired_diagram = desired
    assert actual_diagram == desired_diagram, (
        "Diagram's rendering differs from the desired rendering.\n"
        '\n'
        'Actual rendering:\n'
        f'{actual_diagram}\n'
        '\n'
        'Desired rendering:\n'
        f'{desired_diagram}\n'
        '\n'
        'Highlighted differences:\n'
        f'{ct.highlight_text_differences(actual_diagram, desired_diagram)}\n'
    )
Determines if a given diagram has the desired rendering.

    Args:
        actual: The text diagram.
        desired: The desired rendering as a string.
        **kwargs: Keyword arguments to be passed to actual.render.
    
cirq-core/cirq/circuits/text_diagram_drawer_test.py