def test_highlight_empty_source() -> None:
    """Don't crash trying to highlight empty source code.

    Issue #11758.
    """
    f = io.StringIO()
    tw = terminalwriter.TerminalWriter(f)
    tw.hasmarkup = True
    tw.code_highlight = True
    tw._write_source([])

    assert f.getvalue() == ""
Don't crash trying to highlight empty source code.

    Issue #11758.
    
testing/io/test_terminalwriter.py