Skip to content

Commit abdb41c

Browse files
committed
implement a test for new functionality
1 parent 08b10a3 commit abdb41c

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

tests/test_execute.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ def test_cell_output_to_nodes(doctree):
556556
cell = from_dict(cell)
557557
output_node, = cell_output_to_nodes(cell["outputs"], True, output_dir, None)
558558
image_node, = output_node.traverse(image)
559-
assert output_node[0].attributes['uri'] == img_locs[index]
559+
assert image_node.attributes['uri'] == img_locs[index]
560560

561561
# Testing inline functionality
562562
outputs = [
@@ -609,7 +609,7 @@ def test_save_script(doctree):
609609
a = 1
610610
print(a)
611611
"""
612-
tree, app, _ = doctree(source, return_all=True)
612+
_, app, _ = doctree(source, return_all=True)
613613
outdir = Path(app.outdir)
614614
saved_text = (outdir / '../jupyter_execute/test.py').read_text()
615615
assert saved_text.startswith('#!/usr/bin/env python')
@@ -690,7 +690,7 @@ def test_output_only_error(doctree):
690690
4
691691
"""
692692
with pytest.raises(ExtensionError):
693-
tree = doctree(source)
693+
doctree(source)
694694

695695
def test_multiple_directives(doctree):
696696
source = """
@@ -714,3 +714,21 @@ def test_multiple_directives(doctree):
714714
assert ex_out.children[0].astext().strip() == "4"
715715
assert jin_in.children[0].astext().strip() == "3 + 3"
716716
assert jin_out.children[0].astext().strip() == "5"
717+
718+
719+
def test_builder_priority(doctree):
720+
source = """
721+
.. jupyter-execute::
722+
723+
display({"text/plain": "I am html output", "text/latex": "I am latex"})
724+
"""
725+
config = (
726+
"render_priority_html = ['text/plain', 'text/latex']\n"
727+
"render_priority_latex = ['text/latex', 'text/plain']"
728+
)
729+
_, app, _ = doctree(source, config=config, return_all=True, buildername="html")
730+
html = (Path(app.outdir) / "index.html").read_text()
731+
assert "I am html output" in html
732+
_, app, _ = doctree(source, config=config, return_all=True, buildername="latex")
733+
latex = (Path(app.outdir) / "python.tex").read_text()
734+
assert "I am latex" in latex

0 commit comments

Comments
 (0)