@@ -213,19 +213,32 @@ def test_combining(self) -> None:
213213
214214
215215@pytest .mark .parametrize (
216- "has_markup, expected" ,
216+ ( "has_markup" , "code_highlight" , " expected") ,
217217 [
218218 pytest .param (
219- True , "{kw}assert{hl-reset} {number}0{hl-reset}\n " , id = "with markup"
219+ True ,
220+ True ,
221+ "{kw}assert{hl-reset} {number}0{hl-reset}\n " ,
222+ id = "with markup and code_highlight" ,
223+ ),
224+ pytest .param (
225+ True , False , "assert 0\n " , id = "with markup but no code_highlight" ,
226+ ),
227+ pytest .param (
228+ False , True , "assert 0\n " , id = "with markup but no code_highlight" ,
229+ ),
230+ pytest .param (
231+ False , False , "assert 0\n " , id = "neither markup nor code_highlight" ,
220232 ),
221- pytest .param (False , "assert 0\n " , id = "no markup" ),
222233 ],
223234)
224- def test_code_highlight (has_markup , expected , color_mapping ):
235+ def test_code_highlight (has_markup , code_highlight , expected , color_mapping ):
225236 f = io .StringIO ()
226237 tw = terminalwriter .TerminalWriter (f )
227238 tw .hasmarkup = has_markup
239+ tw .code_highlight = code_highlight
228240 tw ._write_source (["assert 0" ])
241+
229242 assert f .getvalue ().splitlines (keepends = True ) == color_mapping .format ([expected ])
230243
231244 with pytest .raises (
0 commit comments