MCPcopy
hub / github.com/pytest-dev/pytest / test_highlight_empty_source

Function test_highlight_empty_source

testing/io/test_terminalwriter.py:314–325  ·  view source on GitHub ↗

Don't crash trying to highlight empty source code. Issue #11758.

()

Source from the content-addressed store, hash-verified

312
313
314def test_highlight_empty_source() -> None:
315 """Don't crash trying to highlight empty source code.
316
317 Issue #11758.
318 """
319 f = io.StringIO()
320 tw = terminalwriter.TerminalWriter(f)
321 tw.hasmarkup = True
322 tw.code_highlight = True
323 tw._write_source([])
324
325 assert f.getvalue() == ""

Callers

nothing calls this directly

Calls 2

_write_sourceMethod · 0.95
getvalueMethod · 0.45

Tested by

no test coverage detected