summaryrefslogtreecommitdiffstats
path: root/tests/test_directives
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:57:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:57:07 +0000
commit46fc0a4b3dccce58c429f408c04cf5cda3af9fb5 (patch)
tree410d83c434319e0c6f8035cdfa60ae8957b1d909 /tests/test_directives
parentAdding upstream version 7.3.7. (diff)
downloadsphinx-upstream.tar.xz
sphinx-upstream.zip
Adding upstream version 7.4.7.upstream/7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_directives')
-rw-r--r--tests/test_directives/test_directive_code.py16
-rw-r--r--tests/test_directives/test_directive_other.py12
2 files changed, 20 insertions, 8 deletions
diff --git a/tests/test_directives/test_directive_code.py b/tests/test_directives/test_directive_code.py
index 2783d8f..6180195 100644
--- a/tests/test_directives/test_directive_code.py
+++ b/tests/test_directives/test_directive_code.py
@@ -104,7 +104,7 @@ def test_LiteralIncludeReader_lines_and_lineno_match1(literal_inc_path):
assert reader.lineno_start == 3
-@pytest.mark.sphinx() # init locale for errors
+@pytest.mark.sphinx # init locale for errors
def test_LiteralIncludeReader_lines_and_lineno_match2(literal_inc_path, app, status, warning):
options = {'lines': '0,3,5', 'lineno-match': True}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
@@ -112,7 +112,7 @@ def test_LiteralIncludeReader_lines_and_lineno_match2(literal_inc_path, app, sta
reader.read()
-@pytest.mark.sphinx() # init locale for errors
+@pytest.mark.sphinx # init locale for errors
def test_LiteralIncludeReader_lines_and_lineno_match3(literal_inc_path, app, status, warning):
options = {'lines': '100-', 'lineno-match': True}
reader = LiteralIncludeReader(literal_inc_path, options, DUMMY_CONFIG)
@@ -330,7 +330,7 @@ def test_code_block_caption_html(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_code_block_caption_latex(app, status, warning):
app.build(force_all=True)
- latex = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
caption = '\\sphinxSetupCaptionForVerbatim{caption \\sphinxstyleemphasis{test} rb}'
label = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:id1}}}'
link = '\\hyperref[\\detokenize{caption:name-test-rb}]' \
@@ -343,7 +343,7 @@ def test_code_block_caption_latex(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_code_block_namedlink_latex(app, status, warning):
app.build(force_all=True)
- latex = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
label1 = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:name-test-rb}}}'
link1 = '\\hyperref[\\detokenize{caption:name-test-rb}]'\
'{\\sphinxcrossref{\\DUrole{std,std-ref}{Ruby}}'
@@ -360,7 +360,7 @@ def test_code_block_namedlink_latex(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_code_block_emphasize_latex(app, status, warning):
app.build(filenames=[app.srcdir / 'emphasize.rst'])
- latex = (app.outdir / 'python.tex').read_text(encoding='utf8').replace('\r\n', '\n')
+ latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8').replace('\r\n', '\n')
includes = '\\fvset{hllines={, 5, 6, 13, 14, 15, 24, 25, 26,}}%\n'
assert includes in latex
includes = '\\end{sphinxVerbatim}\n\\sphinxresetverbatimhllines\n'
@@ -424,7 +424,7 @@ def test_literal_include_linenos(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_literalinclude_file_whole_of_emptyline(app, status, warning):
app.build(force_all=True)
- latex = (app.outdir / 'python.tex').read_text(encoding='utf8').replace('\r\n', '\n')
+ latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8').replace('\r\n', '\n')
includes = (
'\\begin{sphinxVerbatim}'
'[commandchars=\\\\\\{\\},numbers=left,firstnumber=1,stepnumber=1]\n'
@@ -450,7 +450,7 @@ def test_literalinclude_caption_html(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_literalinclude_caption_latex(app, status, warning):
app.build(filenames='index')
- latex = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
caption = '\\sphinxSetupCaptionForVerbatim{caption \\sphinxstylestrong{test} py}'
label = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:id2}}}'
link = '\\hyperref[\\detokenize{caption:name-test-py}]' \
@@ -463,7 +463,7 @@ def test_literalinclude_caption_latex(app, status, warning):
@pytest.mark.sphinx('latex', testroot='directive-code')
def test_literalinclude_namedlink_latex(app, status, warning):
app.build(filenames='index')
- latex = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ latex = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
label1 = '\\def\\sphinxLiteralBlockLabel{\\label{\\detokenize{caption:name-test-py}}}'
link1 = '\\hyperref[\\detokenize{caption:name-test-py}]'\
'{\\sphinxcrossref{\\DUrole{std,std-ref}{Python}}'
diff --git a/tests/test_directives/test_directive_other.py b/tests/test_directives/test_directive_other.py
index 1feb251..e00e291 100644
--- a/tests/test_directives/test_directive_other.py
+++ b/tests/test_directives/test_directive_other.py
@@ -137,6 +137,18 @@ def test_reversed_toctree(app):
@pytest.mark.sphinx(testroot='toctree-glob')
+def test_toctree_class(app):
+ text = ('.. toctree::\n'
+ ' :class: custom-toc\n'
+ '\n'
+ ' foo\n')
+ app.env.find_files(app.config, app.builder)
+ doctree = restructuredtext.parse(app, text, 'index')
+ assert_node(doctree, [nodes.document, nodes.compound, addnodes.toctree])
+ assert doctree[0].attributes['classes'] == ['toctree-wrapper', 'custom-toc']
+
+
+@pytest.mark.sphinx(testroot='toctree-glob')
def test_toctree_twice(app):
text = (".. toctree::\n"
"\n"