summaryrefslogtreecommitdiff
path: root/tests/test_build_html.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-16 21:51:46 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-16 21:51:46 +0900
commit30f8640bab786b28e2fbc3a12a4cf212e6f953d1 (patch)
treef5cf23900a7bc509fe970262195995ddc526fda1 /tests/test_build_html.py
parent5460ea103bd91ce910e50e11e05c1e5340c2a9e0 (diff)
parent7c340e1c1c43f173f11efc14feb29cd08cedb995 (diff)
downloadsphinx-git-30f8640bab786b28e2fbc3a12a4cf212e6f953d1.tar.gz
Merge branch '3.x'
Diffstat (limited to 'tests/test_build_html.py')
-rw-r--r--tests/test_build_html.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/test_build_html.py b/tests/test_build_html.py
index eecd25d07..6bfbe422b 100644
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -12,6 +12,7 @@ import os
import re
from distutils.version import LooseVersion
from itertools import chain, cycle
+from unittest.mock import ANY, call, patch
import pygments
import pytest
@@ -1607,3 +1608,36 @@ def test_html_codeblock_linenos_style_inline(app):
assert '<span class="linenos">1</span>' in content
else:
assert '<span class="lineno">1 </span>' in content
+
+
+@pytest.mark.sphinx('html', testroot='highlight_options')
+def test_highlight_options(app):
+ subject = app.builder.highlighter
+ with patch.object(subject, 'highlight_block', wraps=subject.highlight_block) as highlight:
+ app.build()
+
+ call_args = highlight.call_args_list
+ assert len(call_args) == 3
+ assert call_args[0] == call(ANY, 'default', force=False, linenos=False,
+ location=ANY, opts={'default_option': True})
+ assert call_args[1] == call(ANY, 'python', force=False, linenos=False,
+ location=ANY, opts={'python_option': True})
+ assert call_args[2] == call(ANY, 'java', force=False, linenos=False,
+ location=ANY, opts={})
+
+
+@pytest.mark.sphinx('html', testroot='highlight_options',
+ confoverrides={'highlight_options': {'default_option': True}})
+def test_highlight_options_old(app):
+ subject = app.builder.highlighter
+ with patch.object(subject, 'highlight_block', wraps=subject.highlight_block) as highlight:
+ app.build()
+
+ call_args = highlight.call_args_list
+ assert len(call_args) == 3
+ assert call_args[0] == call(ANY, 'default', force=False, linenos=False,
+ location=ANY, opts={'default_option': True})
+ assert call_args[1] == call(ANY, 'python', force=False, linenos=False,
+ location=ANY, opts={})
+ assert call_args[2] == call(ANY, 'java', force=False, linenos=False,
+ location=ANY, opts={})