From 6bee0ad7dda5e17fd212be9c3dcfb9d2cb8996c6 2014-10-15 20:29:59 From: Jessica B. Hamrick Date: 2014-10-15 20:29:59 Subject: [PATCH] Add regression test for latex color prompts --- diff --git a/IPython/nbconvert/exporters/tests/test_latex.py b/IPython/nbconvert/exporters/tests/test_latex.py index a6effc9..d2ea966 100644 --- a/IPython/nbconvert/exporters/tests/test_latex.py +++ b/IPython/nbconvert/exporters/tests/test_latex.py @@ -5,6 +5,7 @@ import os.path import textwrap +import re from .base import ExportersTestsBase from ..latex import LatexExporter @@ -99,3 +100,18 @@ class TestLatexExporter(ExportersTestsBase): (output, resources) = LatexExporter(template_file='article').from_filename(nbfile) assert len(output) > 0 + + @onlyif_cmds_exist('pandoc') + def test_prompt_number_color(self): + """ + Does LatexExporter properly format input and output prompts in color? + """ + (output, resources) = LatexExporter().from_filename(self._get_notebook()) + in_regex = r"In \[\{\\color\{incolor\}(.*)\}\]:" + out_regex = r"Out\[\{\\color\{outcolor\}(.*)\}\]:" + + ins = ["1", "2", "6", "7", "8", "10", "14", " ", " "] + outs = ["7", "10", "14"] + + assert re.findall(in_regex, output) == ins + assert re.findall(out_regex, output) == outs