summaryrefslogtreecommitdiffstats
path: root/tests/test_builders/test_build_latex.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_builders/test_build_latex.py')
-rw-r--r--tests/test_builders/test_build_latex.py166
1 files changed, 100 insertions, 66 deletions
diff --git a/tests/test_builders/test_build_latex.py b/tests/test_builders/test_build_latex.py
index 0776c74..56505b4 100644
--- a/tests/test_builders/test_build_latex.py
+++ b/tests/test_builders/test_build_latex.py
@@ -41,7 +41,7 @@ def kpsetest(*filenames):
# compile latex document with app.config.latex_engine
-def compile_latex_document(app, filename='python.tex', docclass='manual'):
+def compile_latex_document(app, filename='projectnamenotset.tex', docclass='manual'):
# now, try to run latex over it
try:
with chdir(app.outdir):
@@ -158,21 +158,21 @@ def test_writer(app, status, warning):
assert ('\\begin{wrapfigure}{r}{0pt}\n\\centering\n'
'\\noindent\\sphinxincludegraphics{{rimg}.png}\n'
- '\\caption{figure with align option}\\label{\\detokenize{markup:id9}}'
+ '\\caption{figure with align option}\\label{\\detokenize{markup:id10}}'
'\\end{wrapfigure}\n\n'
'\\mbox{}\\par\\vskip-\\dimexpr\\baselineskip+\\parskip\\relax' in result)
assert ('\\begin{wrapfigure}{r}{0.500\\linewidth}\n\\centering\n'
'\\noindent\\sphinxincludegraphics{{rimg}.png}\n'
'\\caption{figure with align \\& figwidth option}'
- '\\label{\\detokenize{markup:id10}}'
+ '\\label{\\detokenize{markup:id11}}'
'\\end{wrapfigure}\n\n'
'\\mbox{}\\par\\vskip-\\dimexpr\\baselineskip+\\parskip\\relax' in result)
assert ('\\begin{wrapfigure}{r}{3cm}\n\\centering\n'
'\\noindent\\sphinxincludegraphics[width=3cm]{{rimg}.png}\n'
'\\caption{figure with align \\& width option}'
- '\\label{\\detokenize{markup:id11}}'
+ '\\label{\\detokenize{markup:id12}}'
'\\end{wrapfigure}\n\n'
'\\mbox{}\\par\\vskip-\\dimexpr\\baselineskip+\\parskip\\relax' in result)
@@ -255,7 +255,7 @@ def test_latex_basic_howto_ja(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-theme')
def test_latex_theme(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert r'\def\sphinxdocclass{book}' in result
assert r'\documentclass[a4paper,12pt,english]{sphinxbook}' in result
@@ -266,7 +266,7 @@ def test_latex_theme(app, status, warning):
'pointsize': '9pt'}})
def test_latex_theme_papersize(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert r'\def\sphinxdocclass{book}' in result
assert r'\documentclass[b5paper,9pt,english]{sphinxbook}' in result
@@ -277,7 +277,7 @@ def test_latex_theme_papersize(app, status, warning):
'pointsize': '9pt'}})
def test_latex_theme_options(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert r'\def\sphinxdocclass{book}' in result
assert r'\documentclass[b5paper,9pt,english]{sphinxbook}' in result
@@ -330,7 +330,7 @@ def test_latex_release(app, status, warning):
confoverrides={'numfig': True})
def test_numref(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -372,7 +372,7 @@ def test_numref(app, status, warning):
'section': 'SECTION-%s'}})
def test_numref_with_prefix1(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -420,7 +420,7 @@ def test_numref_with_prefix1(app, status, warning):
'section': 'SECTION_%s_'}})
def test_numref_with_prefix2(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -460,7 +460,7 @@ def test_numref_with_prefix2(app, status, warning):
confoverrides={'numfig': True, 'language': 'ja'})
def test_numref_with_language_ja(app, status, warning):
app.build()
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -556,7 +556,7 @@ def test_latex_add_latex_package(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-babel')
def test_babel_with_no_language_settings(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -581,7 +581,7 @@ def test_babel_with_no_language_settings(app, status, warning):
confoverrides={'language': 'de'})
def test_babel_with_language_de(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -606,7 +606,7 @@ def test_babel_with_language_de(app, status, warning):
confoverrides={'language': 'ru'})
def test_babel_with_language_ru(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -631,7 +631,7 @@ def test_babel_with_language_ru(app, status, warning):
confoverrides={'language': 'tr'})
def test_babel_with_language_tr(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -656,7 +656,7 @@ def test_babel_with_language_tr(app, status, warning):
confoverrides={'language': 'ja'})
def test_babel_with_language_ja(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -680,7 +680,7 @@ def test_babel_with_language_ja(app, status, warning):
confoverrides={'language': 'unknown'})
def test_babel_with_unknown_language(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -707,7 +707,7 @@ def test_babel_with_unknown_language(app, status, warning):
confoverrides={'language': 'de', 'latex_engine': 'lualatex'})
def test_polyglossia_with_language_de(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -733,7 +733,7 @@ def test_polyglossia_with_language_de(app, status, warning):
confoverrides={'language': 'de-1901', 'latex_engine': 'lualatex'})
def test_polyglossia_with_language_de_1901(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -786,7 +786,7 @@ def test_footnote(app, status, warning):
@pytest.mark.sphinx('latex', testroot='footnotes')
def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -826,7 +826,7 @@ def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning):
@pytest.mark.sphinx('latex', testroot='footnotes')
def test_footnote_referred_multiple_times(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -848,7 +848,7 @@ def test_footnote_referred_multiple_times(app, status, warning):
confoverrides={'latex_show_urls': 'inline'})
def test_latex_show_urls_is_inline(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -905,7 +905,7 @@ def test_latex_show_urls_is_inline(app, status, warning):
confoverrides={'latex_show_urls': 'footnote'})
def test_latex_show_urls_is_footnote(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -967,7 +967,7 @@ def test_latex_show_urls_is_footnote(app, status, warning):
confoverrides={'latex_show_urls': 'no'})
def test_latex_show_urls_is_no(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1022,7 +1022,7 @@ def test_latex_show_urls_footnote_and_substitutions(app, status, warning):
@pytest.mark.sphinx('latex', testroot='image-in-section')
def test_image_in_section(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1045,7 +1045,7 @@ def test_latex_logo_if_not_found(app, status, warning):
@pytest.mark.sphinx('latex', testroot='toctree-maxdepth')
def test_toctree_maxdepth_manual(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1057,12 +1057,12 @@ def test_toctree_maxdepth_manual(app, status, warning):
@pytest.mark.sphinx(
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_documents': [
- ('index', 'python.tex', 'Sphinx Tests Documentation',
+ ('index', 'projectnamenotset.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'howto'),
]})
def test_toctree_maxdepth_howto(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1076,7 +1076,7 @@ def test_toctree_maxdepth_howto(app, status, warning):
confoverrides={'root_doc': 'foo'})
def test_toctree_not_found(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1090,7 +1090,7 @@ def test_toctree_not_found(app, status, warning):
confoverrides={'root_doc': 'bar'})
def test_toctree_without_maxdepth(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1103,7 +1103,7 @@ def test_toctree_without_maxdepth(app, status, warning):
confoverrides={'root_doc': 'qux'})
def test_toctree_with_deeper_maxdepth(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1116,7 +1116,7 @@ def test_toctree_with_deeper_maxdepth(app, status, warning):
confoverrides={'latex_toplevel_sectioning': None})
def test_latex_toplevel_sectioning_is_None(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1128,7 +1128,7 @@ def test_latex_toplevel_sectioning_is_None(app, status, warning):
confoverrides={'latex_toplevel_sectioning': 'part'})
def test_latex_toplevel_sectioning_is_part(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1141,12 +1141,12 @@ def test_latex_toplevel_sectioning_is_part(app, status, warning):
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'part',
'latex_documents': [
- ('index', 'python.tex', 'Sphinx Tests Documentation',
+ ('index', 'projectnamenotset.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'howto'),
]})
def test_latex_toplevel_sectioning_is_part_with_howto(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1160,7 +1160,7 @@ def test_latex_toplevel_sectioning_is_part_with_howto(app, status, warning):
confoverrides={'latex_toplevel_sectioning': 'chapter'})
def test_latex_toplevel_sectioning_is_chapter(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1171,12 +1171,12 @@ def test_latex_toplevel_sectioning_is_chapter(app, status, warning):
'latex', testroot='toctree-maxdepth',
confoverrides={'latex_toplevel_sectioning': 'chapter',
'latex_documents': [
- ('index', 'python.tex', 'Sphinx Tests Documentation',
+ ('index', 'projectnamenotset.tex', 'Sphinx Tests Documentation',
'Georg Brandl', 'howto'),
]})
def test_latex_toplevel_sectioning_is_chapter_with_howto(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1188,7 +1188,7 @@ def test_latex_toplevel_sectioning_is_chapter_with_howto(app, status, warning):
confoverrides={'latex_toplevel_sectioning': 'section'})
def test_latex_toplevel_sectioning_is_section(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
@@ -1199,11 +1199,11 @@ def test_latex_toplevel_sectioning_is_section(app, status, warning):
@pytest.mark.sphinx('latex', testroot='maxlistdepth')
def test_maxlistdepth_at_ten(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
print(status.getvalue())
print(warning.getvalue())
- compile_latex_document(app, 'python.tex')
+ compile_latex_document(app, 'projectnamenotset.tex')
@pytest.mark.sphinx('latex', testroot='latex-table',
@@ -1211,7 +1211,7 @@ def test_maxlistdepth_at_ten(app, status, warning):
@pytest.mark.test_params(shared_result='latex-table')
def test_latex_table_tabulars(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
tables = {}
for chap in re.split(r'\\(?:section|chapter){', result)[1:]:
sectname, content = chap.split('}', 1)
@@ -1282,7 +1282,7 @@ def test_latex_table_tabulars(app, status, warning):
@pytest.mark.test_params(shared_result='latex-table')
def test_latex_table_longtable(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
tables = {}
for chap in re.split(r'\\(?:section|chapter){', result)[1:]:
sectname, content = chap.split('}', 1)
@@ -1343,7 +1343,7 @@ def test_latex_table_longtable(app, status, warning):
@pytest.mark.test_params(shared_result='latex-table')
def test_latex_table_complex_tables(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
tables = {}
for chap in re.split(r'\\(?:section|renewcommand){', result)[1:]:
sectname, content = chap.split('}', 1)
@@ -1373,7 +1373,7 @@ def test_latex_table_complex_tables(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-table')
def test_latex_table_with_booktabs_and_colorrows(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert r'\PassOptionsToPackage{booktabs}{sphinx}' in result
assert r'\PassOptionsToPackage{colorrows}{sphinx}' in result
# tabularcolumns
@@ -1389,15 +1389,16 @@ def test_latex_table_with_booktabs_and_colorrows(app, status, warning):
confoverrides={'templates_path': ['_mytemplates/latex']})
def test_latex_table_custom_template_caseA(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert 'SALUT LES COPAINS' in result
+ assert 'AU REVOIR, KANIGGETS' in result
@pytest.mark.sphinx('latex', testroot='latex-table',
confoverrides={'templates_path': ['_mytemplates']})
def test_latex_table_custom_template_caseB(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert 'SALUT LES COPAINS' not in result
@@ -1405,14 +1406,14 @@ def test_latex_table_custom_template_caseB(app, status, warning):
@pytest.mark.test_params(shared_result='latex-table')
def test_latex_table_custom_template_caseC(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert 'SALUT LES COPAINS' not in result
@pytest.mark.sphinx('latex', testroot='directives-raw')
def test_latex_raw_directive(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# standard case
assert 'standalone raw directive (HTML)' not in result
@@ -1429,7 +1430,7 @@ def test_latex_images(app, status, warning):
with http_server(RemoteImageHandler, port=7777):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# images are copied
assert '\\sphinxincludegraphics{{sphinx}.png}' in result
@@ -1453,7 +1454,7 @@ def test_latex_images(app, status, warning):
def test_latex_index(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert ('A \\index{famous@\\spxentry{famous}}famous '
'\\index{equation@\\spxentry{equation}}equation:\n' in result)
assert ('\n\\index{Einstein@\\spxentry{Einstein}}'
@@ -1467,7 +1468,7 @@ def test_latex_index(app, status, warning):
def test_latex_equations(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
expected = (app.srcdir / 'expects' / 'latex-equations.tex').read_text(encoding='utf8').strip()
assert expected in result
@@ -1477,7 +1478,7 @@ def test_latex_equations(app, status, warning):
def test_latex_image_in_parsed_literal(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert ('{\\sphinxunactivateextrasandspace \\raisebox{-0.5\\height}'
'{\\sphinxincludegraphics[height=2.00000cm]{{pic}.png}}'
'}AFTER') in result
@@ -1487,7 +1488,7 @@ def test_latex_image_in_parsed_literal(app, status, warning):
def test_latex_nested_enumerated_list(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert ('\\sphinxsetlistlabels{\\arabic}{enumi}{enumii}{}{.}%\n'
'\\setcounter{enumi}{4}\n' in result)
assert ('\\sphinxsetlistlabels{\\alph}{enumii}{enumiii}{}{.}%\n'
@@ -1504,7 +1505,7 @@ def test_latex_nested_enumerated_list(app, status, warning):
def test_latex_thebibliography(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert ('\\begin{sphinxthebibliography}{AuthorYe}\n'
'\\bibitem[AuthorYear]{index:authoryear}\n\\sphinxAtStartPar\n'
@@ -1517,7 +1518,7 @@ def test_latex_thebibliography(app, status, warning):
def test_latex_glossary(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert (r'\sphinxlineitem{ähnlich\index{ähnlich@\spxentry{ähnlich}|spxpagem}'
r'\phantomsection'
r'\label{\detokenize{index:term-ahnlich}}}' in result)
@@ -1541,7 +1542,7 @@ def test_latex_glossary(app, status, warning):
def test_latex_labels(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# figures
assert (r'\caption{labeled figure}'
@@ -1589,8 +1590,10 @@ def test_latex_labels(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-figure-in-admonition')
def test_latex_figure_in_admonition(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
- assert r'\begin{figure}[H]' in result
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
+ assert 'tabulary' not in result
+ for type in ('caution', 'note', 'seealso', 'todo'):
+ assert f'{type} directive.\n\n\\begin{{figure}}[H]' in result
def test_default_latex_documents():
@@ -1619,7 +1622,7 @@ def test_includegraphics_oversized(app, status, warning):
@pytest.mark.sphinx('latex', testroot='index_on_title')
def test_index_on_title(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert ('\\chapter{Test for index in top level title}\n'
'\\label{\\detokenize{contents:test-for-index-in-top-level-title}}'
'\\index{index@\\spxentry{index}}\n'
@@ -1630,7 +1633,7 @@ def test_index_on_title(app, status, warning):
confoverrides={'latex_engine': 'pdflatex'})
def test_texescape_for_non_unicode_supported_engine(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert 'script small e: e' in result
assert 'double struck italic small i: i' in result
@@ -1642,7 +1645,7 @@ def test_texescape_for_non_unicode_supported_engine(app, status, warning):
confoverrides={'latex_engine': 'xelatex'})
def test_texescape_for_unicode_supported_engine(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
print(result)
assert 'script small e: e' in result
assert 'double struck italic small i: i' in result
@@ -1667,7 +1670,7 @@ def test_latex_nested_tables(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-container')
def test_latex_container(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
assert r'\begin{sphinxuseclass}{classname}' in result
assert r'\end{sphinxuseclass}' in result
@@ -1675,7 +1678,7 @@ def test_latex_container(app, status, warning):
@pytest.mark.sphinx('latex', testroot='reST-code-role')
def test_latex_code_role(app):
app.build()
- content = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ content = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
common_content = (
r'\PYG{k}{def} '
@@ -1710,6 +1713,7 @@ def test_copy_images(app, status, warning):
}
images.discard('sphinx.png')
assert images == {
+ 'ba30773957c3fe046897111afd65a80b81cad089.png', # latex: image from data:image/png URI in source
'img.pdf',
'rimg.png',
'testimäge.png',
@@ -1719,7 +1723,7 @@ def test_copy_images(app, status, warning):
@pytest.mark.sphinx('latex', testroot='latex-labels-before-module')
def test_duplicated_labels_before_module(app, status, warning):
app.build()
- content: str = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ content: str = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
def count_label(name):
text = r'\phantomsection\label{\detokenize{%s}}' % name
@@ -1750,10 +1754,40 @@ def test_duplicated_labels_before_module(app, status, warning):
confoverrides={'python_maximum_signature_line_length': 23})
def test_one_parameter_per_line(app, status, warning):
app.build(force_all=True)
- result = (app.outdir / 'python.tex').read_text(encoding='utf8')
+ result = (app.outdir / 'projectnamenotset.tex').read_text(encoding='utf8')
# TODO: should these asserts check presence or absence of a final \sphinxparamcomma?
# signature of 23 characters is too short to trigger one-param-per-line mark-up
assert ('\\pysiglinewithargsret{\\sphinxbfcode{\\sphinxupquote{hello}}}' in result)
assert ('\\pysigwithonelineperarg{\\sphinxbfcode{\\sphinxupquote{foo}}}' in result)
+
+ # generic_arg[T]
+ assert ('\\pysiglinewithargsretwithtypelist{\\sphinxbfcode{\\sphinxupquote{generic\\_arg}}}'
+ '{\\sphinxtypeparam{\\DUrole{n}{T}}}{}{}' in result)
+
+ # generic_foo[T]()
+ assert ('\\pysiglinewithargsretwithtypelist{\\sphinxbfcode{\\sphinxupquote{generic\\_foo}}}' in result)
+
+ # generic_bar[T](x: list[T])
+ assert ('\\pysigwithonelineperargwithtypelist{\\sphinxbfcode{\\sphinxupquote{generic\\_bar}}}' in result)
+
+ # generic_ret[R]() -> R
+ assert ('\\pysiglinewithargsretwithtypelist{\\sphinxbfcode{\\sphinxupquote{generic\\_ret}}}'
+ '{\\sphinxtypeparam{\\DUrole{n}{R}}}{}{{ $\\rightarrow$ R}}' in result)
+
+ # MyGenericClass[X]
+ assert ('\\pysiglinewithargsretwithtypelist{\\sphinxbfcode{\\sphinxupquote{class\\DUrole{w}{ '
+ '}}}\\sphinxbfcode{\\sphinxupquote{MyGenericClass}}}' in result)
+
+ # MyList[T](list[T])
+ assert ('\\pysiglinewithargsretwithtypelist{\\sphinxbfcode{\\sphinxupquote{class\\DUrole{w}{ '
+ '}}}\\sphinxbfcode{\\sphinxupquote{MyList}}}' in result)
+
+
+@pytest.mark.sphinx('latex', testroot='markup-rubric')
+def test_latex_rubric(app):
+ app.build()
+ content = (app.outdir / 'test.tex').read_text(encoding='utf8')
+ assert r'\subsubsection*{This is a rubric}' in content
+ assert r'\subsection*{A rubric with a heading level 2}' in content