diff options
Diffstat (limited to 'tests')
27 files changed, 211 insertions, 178 deletions
diff --git a/tests/roots/test-latex-table/expects/complex_spanning_cell.tex b/tests/roots/test-latex-table/expects/complex_spanning_cell.tex index 3d9e5cae1..5d524c257 100644 --- a/tests/roots/test-latex-table/expects/complex_spanning_cell.tex +++ b/tests/roots/test-latex-table/expects/complex_spanning_cell.tex @@ -2,10 +2,10 @@ table having … \begin{itemize} \item {} -consecutive multirow at top of row (1-1 and 1-2) +consecutive multirow at top of row (1\sphinxhyphen{}1 and 1\sphinxhyphen{}2) \item {} -consecutive multirow at end of row (1-4 and 1-5) +consecutive multirow at end of row (1\sphinxhyphen{}4 and 1\sphinxhyphen{}5) \end{itemize} @@ -16,40 +16,40 @@ consecutive multirow at end of row (1-4 and 1-5) \hline \sphinxmultirow{3}{1}{% \begin{varwidth}[t]{\sphinxcolwidth{1}{5}} -cell1-1 +cell1\sphinxhyphen{}1 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% }% &\sphinxmultirow{3}{2}{% \begin{varwidth}[t]{\sphinxcolwidth{1}{5}} -cell1-2 +cell1\sphinxhyphen{}2 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% }% & -cell1-3 +cell1\sphinxhyphen{}3 &\sphinxmultirow{3}{4}{% \begin{varwidth}[t]{\sphinxcolwidth{1}{5}} -cell1-4 +cell1\sphinxhyphen{}4 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% }% &\sphinxmultirow{2}{5}{% \begin{varwidth}[t]{\sphinxcolwidth{1}{5}} -cell1-5 +cell1\sphinxhyphen{}5 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% }% \\ \cline{3-3}\sphinxtablestrut{1}&\sphinxtablestrut{2}&\sphinxmultirow{2}{6}{% \begin{varwidth}[t]{\sphinxcolwidth{1}{5}} -cell2-3 +cell2\sphinxhyphen{}3 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% }% &\sphinxtablestrut{4}&\sphinxtablestrut{5}\\ \cline{5-5}\sphinxtablestrut{1}&\sphinxtablestrut{2}&\sphinxtablestrut{6}&\sphinxtablestrut{4}& -cell3-5 +cell3\sphinxhyphen{}5 \\ \hline \end{tabulary} diff --git a/tests/roots/test-latex-table/expects/gridtable.tex b/tests/roots/test-latex-table/expects/gridtable.tex index cb74bea77..28b0b086b 100644 --- a/tests/roots/test-latex-table/expects/gridtable.tex +++ b/tests/roots/test-latex-table/expects/gridtable.tex @@ -12,40 +12,40 @@ header2 header3 \\ \hline -cell1-1 +cell1\sphinxhyphen{}1 &\sphinxmultirow{2}{5}{% \begin{varwidth}[t]{\sphinxcolwidth{1}{3}} -cell1-2 +cell1\sphinxhyphen{}2 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% }% & -cell1-3 +cell1\sphinxhyphen{}3 \\ \cline{1-1}\cline{3-3}\sphinxmultirow{2}{7}{% \begin{varwidth}[t]{\sphinxcolwidth{1}{3}} -cell2-1 +cell2\sphinxhyphen{}1 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% }% &\sphinxtablestrut{5}& -cell2-3 +cell2\sphinxhyphen{}3 \\ \cline{2-3}\sphinxtablestrut{7}&\sphinxstartmulticolumn{2}% \sphinxmultirow{2}{9}{% \begin{varwidth}[t]{\sphinxcolwidth{2}{3}} -cell3-2 +cell3\sphinxhyphen{}2 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% }% \sphinxstopmulticolumn \\ \cline{1-1} -cell4-1 +cell4\sphinxhyphen{}1 &\multicolumn{2}{l|}{\sphinxtablestrut{9}}\\ \hline\sphinxstartmulticolumn{3}% \begin{varwidth}[t]{\sphinxcolwidth{3}{3}} -cell5-1 +cell5\sphinxhyphen{}1 \par \vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% \sphinxstopmulticolumn diff --git a/tests/roots/test-latex-table/expects/longtable.tex b/tests/roots/test-latex-table/expects/longtable.tex index 50124ad8a..9febfcef5 100644 --- a/tests/roots/test-latex-table/expects/longtable.tex +++ b/tests/roots/test-latex-table/expects/longtable.tex @@ -27,19 +27,19 @@ header2 \endlastfoot -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_align.tex b/tests/roots/test-latex-table/expects/longtable_having_align.tex index 55ea7ea1b..1969e19d2 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_align.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_align.tex @@ -27,19 +27,19 @@ header2 \endlastfoot -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_caption.tex b/tests/roots/test-latex-table/expects/longtable_having_caption.tex index d28836ad0..f0041e9ec 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_caption.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_caption.tex @@ -29,19 +29,19 @@ header2 \endlastfoot -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex index e38d8ae5f..050527b69 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex @@ -35,17 +35,17 @@ item2 \end{itemize} & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex index 28f9a09e5..68e74c5f4 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex @@ -32,23 +32,23 @@ header3 \endlastfoot \sphinxstyletheadfamily \begin{itemize} \item {} -instub1-1a +instub1\sphinxhyphen{}1a \item {} -instub1-1b +instub1\sphinxhyphen{}1b \end{itemize} &\sphinxstyletheadfamily -instub1-2 +instub1\sphinxhyphen{}2 & -notinstub1-3 +notinstub1\sphinxhyphen{}3 \\ \hline\sphinxstyletheadfamily -cell2-1 +cell2\sphinxhyphen{}1 &\sphinxstyletheadfamily -cell2-2 +cell2\sphinxhyphen{}2 & -cell2-3 +cell2\sphinxhyphen{}3 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex index c9e018e66..c7213b906 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex @@ -31,17 +31,17 @@ header2 \PYG{n}{hello} \PYG{n}{world} \end{sphinxVerbatimintable} & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths.tex b/tests/roots/test-latex-table/expects/longtable_having_widths.tex index 9c449cc48..884fd9f8a 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_widths.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_widths.tex @@ -27,19 +27,19 @@ header2 \endlastfoot -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex index 8eee72125..17c5ec4cc 100644 --- a/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex @@ -35,17 +35,17 @@ item2 \end{itemize} & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex index d4633886d..2fbbbc4ef 100644 --- a/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex +++ b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex @@ -27,19 +27,19 @@ header2 \endlastfoot -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{longtable}\sphinxatlongtableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/simple_table.tex b/tests/roots/test-latex-table/expects/simple_table.tex index 9ad911588..8044a6cc4 100644 --- a/tests/roots/test-latex-table/expects/simple_table.tex +++ b/tests/roots/test-latex-table/expects/simple_table.tex @@ -10,19 +10,19 @@ header1 header2 \\ \hline -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabulary} diff --git a/tests/roots/test-latex-table/expects/table_having_caption.tex b/tests/roots/test-latex-table/expects/table_having_caption.tex index fe0055233..d4423a05d 100644 --- a/tests/roots/test-latex-table/expects/table_having_caption.tex +++ b/tests/roots/test-latex-table/expects/table_having_caption.tex @@ -14,19 +14,19 @@ header1 header2 \\ \hline -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabulary} diff --git a/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex index 561a98010..7a9b0f293 100644 --- a/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex @@ -18,17 +18,17 @@ item2 \end{itemize} & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabular} diff --git a/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex index 6904c43c3..700fc4663 100644 --- a/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex @@ -13,23 +13,23 @@ header3 \\ \hline\sphinxstyletheadfamily \begin{itemize} \item {} -instub1-1a +instub1\sphinxhyphen{}1a \item {} -instub1-1b +instub1\sphinxhyphen{}1b \end{itemize} &\sphinxstyletheadfamily -instub1-2 +instub1\sphinxhyphen{}2 & -notinstub1-3 +notinstub1\sphinxhyphen{}3 \\ \hline\sphinxstyletheadfamily -cell2-1 +cell2\sphinxhyphen{}1 &\sphinxstyletheadfamily -cell2-2 +cell2\sphinxhyphen{}2 & -cell2-3 +cell2\sphinxhyphen{}3 \\ \hline \end{tabular} diff --git a/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex b/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex index 20d949493..6d3e81021 100644 --- a/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex +++ b/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex @@ -8,11 +8,11 @@ header1 \\ \hline -cell1-1-par1 +cell1\sphinxhyphen{}1\sphinxhyphen{}par1 -cell1-1-par2 +cell1\sphinxhyphen{}1\sphinxhyphen{}par2 -cell1-1-par3 +cell1\sphinxhyphen{}1\sphinxhyphen{}par3 \\ \hline \end{tabulary} diff --git a/tests/roots/test-latex-table/expects/table_having_verbatim.tex b/tests/roots/test-latex-table/expects/table_having_verbatim.tex index 2e2b1dc9a..f66bb8001 100644 --- a/tests/roots/test-latex-table/expects/table_having_verbatim.tex +++ b/tests/roots/test-latex-table/expects/table_having_verbatim.tex @@ -14,17 +14,17 @@ header2 \PYG{n}{hello} \PYG{n}{world} \end{sphinxVerbatimintable} & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabular} diff --git a/tests/roots/test-latex-table/expects/table_having_widths.tex b/tests/roots/test-latex-table/expects/table_having_widths.tex index b4fcea04e..094596bec 100644 --- a/tests/roots/test-latex-table/expects/table_having_widths.tex +++ b/tests/roots/test-latex-table/expects/table_having_widths.tex @@ -11,19 +11,19 @@ header1 header2 \\ \hline -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabular} diff --git a/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex index d3e2e8144..a636b022e 100644 --- a/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex +++ b/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex @@ -18,17 +18,17 @@ item2 \end{itemize} & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabular} diff --git a/tests/roots/test-latex-table/expects/tabular_having_widths.tex b/tests/roots/test-latex-table/expects/tabular_having_widths.tex index ae67fe924..5ee1542d4 100644 --- a/tests/roots/test-latex-table/expects/tabular_having_widths.tex +++ b/tests/roots/test-latex-table/expects/tabular_having_widths.tex @@ -10,19 +10,19 @@ header1 header2 \\ \hline -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabular} diff --git a/tests/roots/test-latex-table/expects/tabularcolumn.tex b/tests/roots/test-latex-table/expects/tabularcolumn.tex index 78d31058f..02e9af440 100644 --- a/tests/roots/test-latex-table/expects/tabularcolumn.tex +++ b/tests/roots/test-latex-table/expects/tabularcolumn.tex @@ -10,19 +10,19 @@ header1 header2 \\ \hline -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabulary} diff --git a/tests/roots/test-latex-table/expects/tabulary_having_widths.tex b/tests/roots/test-latex-table/expects/tabulary_having_widths.tex index 53f1f2aaa..06d347fa3 100644 --- a/tests/roots/test-latex-table/expects/tabulary_having_widths.tex +++ b/tests/roots/test-latex-table/expects/tabulary_having_widths.tex @@ -10,19 +10,19 @@ header1 header2 \\ \hline -cell1-1 +cell1\sphinxhyphen{}1 & -cell1-2 +cell1\sphinxhyphen{}2 \\ \hline -cell2-1 +cell2\sphinxhyphen{}1 & -cell2-2 +cell2\sphinxhyphen{}2 \\ \hline -cell3-1 +cell3\sphinxhyphen{}1 & -cell3-2 +cell3\sphinxhyphen{}2 \\ \hline \end{tabulary} diff --git a/tests/test_build_html.py b/tests/test_build_html.py index 3255bb71e..66164dd1c 100644 --- a/tests/test_build_html.py +++ b/tests/test_build_html.py @@ -97,14 +97,11 @@ def check_xpath(etree, fname, path, check, be_found=True): else: def get_text(node): if node.text is not None: + # the node has only one text return node.text else: - # Since pygments-2.1.1, empty <span> tag is inserted at top of - # highlighting block - if len(node) == 1 and node[0].tag == 'span' and node[0].text is None: - if node[0].tail is not None: - return node[0].tail - return '' + # the node has tags and text; gather texts just under the node + return ''.join(n.tail or '' for n in node) rex = re.compile(check) if be_found: @@ -491,28 +488,40 @@ def test_html_translator(app): (".//li[@class='toctree-l3']/a", '2.2.1. Bar B1', False), ], 'foo.html': [ - (".//h1", '1. Foo', True), - (".//h2", '1.1. Foo A', True), - (".//h3", '1.1.1. Foo A1', True), - (".//h2", '1.2. Foo B', True), - (".//h3", '1.2.1. Foo B1', True), + (".//h1", 'Foo', True), + (".//h2", 'Foo A', True), + (".//h3", 'Foo A1', True), + (".//h2", 'Foo B', True), + (".//h3", 'Foo B1', True), + + (".//h1//span[@class='section-number']", '1. ', True), + (".//h2//span[@class='section-number']", '1.1. ', True), + (".//h3//span[@class='section-number']", '1.1.1. ', True), + (".//h2//span[@class='section-number']", '1.2. ', True), + (".//h3//span[@class='section-number']", '1.2.1. ', True), + (".//div[@class='sphinxsidebarwrapper']//li/a", '1.1. Foo A', True), (".//div[@class='sphinxsidebarwrapper']//li/a", '1.1.1. Foo A1', True), (".//div[@class='sphinxsidebarwrapper']//li/a", '1.2. Foo B', True), (".//div[@class='sphinxsidebarwrapper']//li/a", '1.2.1. Foo B1', True), ], 'bar.html': [ - (".//h1", '2. Bar', True), - (".//h2", '2.1. Bar A', True), - (".//h2", '2.2. Bar B', True), - (".//h3", '2.2.1. Bar B1', True), + (".//h1", 'Bar', True), + (".//h2", 'Bar A', True), + (".//h2", 'Bar B', True), + (".//h3", 'Bar B1', True), + (".//h1//span[@class='section-number']", '2. ', True), + (".//h2//span[@class='section-number']", '2.1. ', True), + (".//h2//span[@class='section-number']", '2.2. ', True), + (".//h3//span[@class='section-number']", '2.2.1. ', True), (".//div[@class='sphinxsidebarwrapper']//li/a", '2. Bar', True), (".//div[@class='sphinxsidebarwrapper']//li/a", '2.1. Bar A', True), (".//div[@class='sphinxsidebarwrapper']//li/a", '2.2. Bar B', True), (".//div[@class='sphinxsidebarwrapper']//li/a", '2.2.1. Bar B1', False), ], 'baz.html': [ - (".//h1", '2.1.1. Baz A', True), + (".//h1", 'Baz A', True), + (".//h1//span[@class='section-number']", '2.1.1. ', True), ], })) @pytest.mark.skipif(docutils.__version_info__ < (0, 13), @@ -536,20 +545,30 @@ def test_tocdepth(app, cached_etree_parse, fname, expect): (".//h1", 'test-tocdepth', True), # foo.rst - (".//h2", '1. Foo', True), - (".//h3", '1.1. Foo A', True), - (".//h4", '1.1.1. Foo A1', True), - (".//h3", '1.2. Foo B', True), - (".//h4", '1.2.1. Foo B1', True), + (".//h2", 'Foo', True), + (".//h3", 'Foo A', True), + (".//h4", 'Foo A1', True), + (".//h3", 'Foo B', True), + (".//h4", 'Foo B1', True), + (".//h2//span[@class='section-number']", '1. ', True), + (".//h3//span[@class='section-number']", '1.1. ', True), + (".//h4//span[@class='section-number']", '1.1.1. ', True), + (".//h3//span[@class='section-number']", '1.2. ', True), + (".//h4//span[@class='section-number']", '1.2.1. ', True), # bar.rst - (".//h2", '2. Bar', True), - (".//h3", '2.1. Bar A', True), - (".//h3", '2.2. Bar B', True), - (".//h4", '2.2.1. Bar B1', True), + (".//h2", 'Bar', True), + (".//h3", 'Bar A', True), + (".//h3", 'Bar B', True), + (".//h4", 'Bar B1', True), + (".//h2//span[@class='section-number']", '2. ', True), + (".//h3//span[@class='section-number']", '2.1. ', True), + (".//h3//span[@class='section-number']", '2.2. ', True), + (".//h4//span[@class='section-number']", '2.2.1. ', True), # baz.rst - (".//h4", '2.1.1. Baz A', True), + (".//h4", 'Baz A', True), + (".//h4//span[@class='section-number']", '2.1.1. ', True), ], })) @pytest.mark.skipif(docutils.__version_info__ < (0, 13), diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index 8c023b8e4..a64805be3 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -193,7 +193,7 @@ def test_latex_title_after_admonitions(app, status, warning): print(result) print(status.getvalue()) print(warning.getvalue()) - assert '\\title{test-latex-title}' in result + assert '\\title{test\\sphinxhyphen{}latex\\sphinxhyphen{}title}' in result @pytest.mark.sphinx('latex', testroot='basic', @@ -227,7 +227,7 @@ def test_numref(app, status, warning): assert ('\\hyperref[\\detokenize{index:code-1}]' '{Listing \\ref{\\detokenize{index:code-1}}}') in result assert ('\\hyperref[\\detokenize{baz:code22}]' - '{Code-\\ref{\\detokenize{baz:code22}}}') in result + '{Code\\sphinxhyphen{}\\ref{\\detokenize{baz:code22}}}') in result assert ('\\hyperref[\\detokenize{foo:foo}]' '{Section \\ref{\\detokenize{foo:foo}}}') in result assert ('\\hyperref[\\detokenize{bar:bar-a}]' @@ -273,13 +273,13 @@ def test_numref_with_prefix1(app, status, warning): assert ('\\hyperref[\\detokenize{baz:table22}]' '{Table:\\ref{\\detokenize{baz:table22}}}') in result assert ('\\hyperref[\\detokenize{index:code-1}]' - '{Code-\\ref{\\detokenize{index:code-1}}}') in result + '{Code\\sphinxhyphen{}\\ref{\\detokenize{index:code-1}}}') in result assert ('\\hyperref[\\detokenize{baz:code22}]' - '{Code-\\ref{\\detokenize{baz:code22}}}') in result + '{Code\\sphinxhyphen{}\\ref{\\detokenize{baz:code22}}}') in result assert ('\\hyperref[\\detokenize{foo:foo}]' - '{SECTION-\\ref{\\detokenize{foo:foo}}}') in result + '{SECTION\\sphinxhyphen{}\\ref{\\detokenize{foo:foo}}}') in result assert ('\\hyperref[\\detokenize{bar:bar-a}]' - '{SECTION-\\ref{\\detokenize{bar:bar-a}}}') in result + '{SECTION\\sphinxhyphen{}\\ref{\\detokenize{bar:bar-a}}}') in result assert ('\\hyperref[\\detokenize{index:fig1}]{Fig.\\ref{\\detokenize{index:fig1}} ' '\\nameref{\\detokenize{index:fig1}}}') in result assert ('\\hyperref[\\detokenize{foo:foo}]{Sect.\\ref{\\detokenize{foo:foo}} ' @@ -314,10 +314,10 @@ def test_numref_with_prefix2(app, status, warning): '{Tab\\_\\ref{\\detokenize{index:table-1}}:}') in result assert ('\\hyperref[\\detokenize{baz:table22}]' '{Table:\\ref{\\detokenize{baz:table22}}}') in result - assert ('\\hyperref[\\detokenize{index:code-1}]{Code-\\ref{\\detokenize{index:code-1}} ' + assert ('\\hyperref[\\detokenize{index:code-1}]{Code\\sphinxhyphen{}\\ref{\\detokenize{index:code-1}} ' '| }') in result assert ('\\hyperref[\\detokenize{baz:code22}]' - '{Code-\\ref{\\detokenize{baz:code22}}}') in result + '{Code\\sphinxhyphen{}\\ref{\\detokenize{baz:code22}}}') in result assert ('\\hyperref[\\detokenize{foo:foo}]' '{SECTION\\_\\ref{\\detokenize{foo:foo}}\\_}') in result assert ('\\hyperref[\\detokenize{bar:bar-a}]' @@ -357,7 +357,7 @@ def test_numref_with_language_ja(app, status, warning): assert ('\\hyperref[\\detokenize{index:code-1}]' '{\u30ea\u30b9\u30c8 \\ref{\\detokenize{index:code-1}}}') in result assert ('\\hyperref[\\detokenize{baz:code22}]' - '{Code-\\ref{\\detokenize{baz:code22}}}') in result + '{Code\\sphinxhyphen{}\\ref{\\detokenize{baz:code22}}}') in result assert ('\\hyperref[\\detokenize{foo:foo}]' '{\\ref{\\detokenize{foo:foo}} \u7ae0}') in result assert ('\\hyperref[\\detokenize{bar:bar-a}]' @@ -692,7 +692,7 @@ def test_reference_in_caption_and_codeblock_in_footnote(app, status, warning): 'Foot note in longtable\n%\n\\end{footnotetext}\\ignorespaces %\n' '\\begin{footnotetext}[10]\\sphinxAtStartFootnote\n' 'Second footnote in caption of longtable\n') in result - assert ('This is a reference to the code-block in the footnote:\n' + assert ('This is a reference to the code\\sphinxhyphen{}block in the footnote:\n' '{\\hyperref[\\detokenize{index:codeblockinfootnote}]' '{\\sphinxcrossref{\\DUrole{std,std-ref}{I am in a footnote}}}}') in result assert ('&\nThis is one more footnote with some code in it %\n' @@ -727,24 +727,24 @@ def test_latex_show_urls_is_inline(app, status, warning): 'First\n%\n\\end{footnote}') in result assert ('Second footnote: %\n\\begin{footnote}[1]\\sphinxAtStartFootnote\n' 'Second\n%\n\\end{footnote}') in result - assert '\\sphinxhref{http://sphinx-doc.org/}{Sphinx} (http://sphinx-doc.org/)' in result + assert '\\sphinxhref{http://sphinx-doc.org/}{Sphinx} (http://sphinx\\sphinxhyphen{}doc.org/)' in result assert ('Third footnote: %\n\\begin{footnote}[3]\\sphinxAtStartFootnote\n' 'Third \\sphinxfootnotemark[4]\n%\n\\end{footnote}%\n' '\\begin{footnotetext}[4]\\sphinxAtStartFootnote\n' 'Footnote inside footnote\n%\n\\end{footnotetext}\\ignorespaces') in result assert ('\\sphinxhref{http://sphinx-doc.org/~test/}{URL including tilde} ' - '(http://sphinx-doc.org/\\textasciitilde{}test/)') in result + '(http://sphinx\\sphinxhyphen{}doc.org/\\textasciitilde{}test/)') in result assert ('\\item[{\\sphinxhref{http://sphinx-doc.org/}{URL in term} ' - '(http://sphinx-doc.org/)}] \\leavevmode\nDescription' in result) + '(http://sphinx\\sphinxhyphen{}doc.org/)}] \\leavevmode\nDescription' in result) assert ('\\item[{Footnote in term \\sphinxfootnotemark[6]}] ' '\\leavevmode%\n\\begin{footnotetext}[6]\\sphinxAtStartFootnote\n' 'Footnote in term\n%\n\\end{footnotetext}\\ignorespaces \n' 'Description') in result assert ('\\item[{\\sphinxhref{http://sphinx-doc.org/}{Term in deflist} ' - '(http://sphinx-doc.org/)}] \\leavevmode\nDescription') in result + '(http://sphinx\\sphinxhyphen{}doc.org/)}] \\leavevmode\nDescription') in result assert '\\sphinxurl{https://github.com/sphinx-doc/sphinx}\n' in result assert ('\\sphinxhref{mailto:sphinx-dev@googlegroups.com}' - '{sphinx-dev@googlegroups.com}') in result + '{sphinx\\sphinxhyphen{}dev@googlegroups.com}') in result @pytest.mark.sphinx( @@ -798,7 +798,7 @@ def test_latex_show_urls_is_footnote(app, status, warning): '\\end{footnotetext}\\ignorespaces \nDescription') in result assert ('\\sphinxurl{https://github.com/sphinx-doc/sphinx}\n' in result) assert ('\\sphinxhref{mailto:sphinx-dev@googlegroups.com}' - '{sphinx-dev@googlegroups.com}\n') in result + '{sphinx\\sphinxhyphen{}dev@googlegroups.com}\n') in result @pytest.mark.sphinx( @@ -841,7 +841,7 @@ def test_latex_show_urls_is_no(app, status, warning): '\\leavevmode\nDescription') in result assert ('\\sphinxurl{https://github.com/sphinx-doc/sphinx}\n' in result) assert ('\\sphinxhref{mailto:sphinx-dev@googlegroups.com}' - '{sphinx-dev@googlegroups.com}\n') in result + '{sphinx\\sphinxhyphen{}dev@googlegroups.com}\n') in result @pytest.mark.sphinx( @@ -1416,7 +1416,7 @@ def test_default_latex_documents(): config.init_values() config.add('latex_engine', None, True, None) expected = [('index', 'stasi.tex', 'STASI™ Documentation', - r"Wolfgang Schäuble \& G'Beckstein.\@{}", 'manual')] + r"Wolfgang Schäuble \& G\textquotesingle{}Beckstein.\@{}", 'manual')] assert default_latex_documents(config) == expected diff --git a/tests/test_config.py b/tests/test_config.py index a5da0d6ec..1d3a49e95 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -119,6 +119,20 @@ def test_overrides(): assert config.value8 == ['abc', 'def', 'ghi'] +def test_overrides_boolean(): + config = Config({}, {'value1': '1', + 'value2': '0', + 'value3': '0'}) + config.add('value1', None, 'env', [bool]) + config.add('value2', None, 'env', [bool]) + config.add('value3', True, 'env', ()) + config.init_values() + + assert config.value1 is True + assert config.value2 is False + assert config.value3 is False + + @mock.patch("sphinx.config.logger") def test_errors_warnings(logger, tempdir): # test the error for syntax errors in the config file diff --git a/tests/test_directive_code.py b/tests/test_directive_code.py index ecf5423c2..5d93449f1 100644 --- a/tests/test_directive_code.py +++ b/tests/test_directive_code.py @@ -573,7 +573,7 @@ def test_literalinclude_pydecorators(app, status, warning): def test_code_block_highlighted(app, status, warning): app.builder.build(['highlight']) doctree = app.env.get_doctree('highlight') - codeblocks = doctree.traverse(nodes.literal_block) + codeblocks = list(doctree.traverse(nodes.literal_block)) assert codeblocks[0]['language'] == 'default' assert codeblocks[1]['language'] == 'python2' diff --git a/tests/test_markup.py b/tests/test_markup.py index 94d1af951..8e00764fc 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -213,7 +213,7 @@ def get_verifier(verify, verify_re): ':menuselection:`&Foo -&&- &Bar`', ('<p><span class="menuselection"><span class="accelerator">F</span>oo ' '-&- <span class="accelerator">B</span>ar</span></p>'), - r'\sphinxmenuselection{\sphinxaccelerator{F}oo -\&- \sphinxaccelerator{B}ar}', + r'\sphinxmenuselection{\sphinxaccelerator{F}oo \sphinxhyphen{}\&\sphinxhyphen{} \sphinxaccelerator{B}ar}', ), ( # interpolation of ampersands in guilabel @@ -221,7 +221,7 @@ def get_verifier(verify, verify_re): ':guilabel:`&Foo -&&- &Bar`', ('<p><span class="guilabel"><span class="accelerator">F</span>oo ' '-&- <span class="accelerator">B</span>ar</span></p>'), - r'\sphinxguilabel{\sphinxaccelerator{F}oo -\&- \sphinxaccelerator{B}ar}', + r'\sphinxguilabel{\sphinxaccelerator{F}oo \sphinxhyphen{}\&\sphinxhyphen{} \sphinxaccelerator{B}ar}', ), ( # no ampersands in guilabel @@ -236,7 +236,7 @@ def get_verifier(verify, verify_re): ':option:`--with-option`', ('<p><code( class="xref std std-option docutils literal notranslate")?>' '<span class="pre">--with-option</span></code></p>$'), - r'\\sphinxcode{\\sphinxupquote{-{-}with-option}}$', + r'\\sphinxcode{\\sphinxupquote{\\sphinxhyphen{}\\sphinxhyphen{}with\\sphinxhyphen{}option}}$', ), ( # verify smarty-pants quotes |