Skip to content

Commit 0f0074c

Browse files
committed
Make the tests pass with Docutils 0.22
1 parent 71d22b5 commit 0f0074c

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

tests/test_render.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from autodoc2.render.myst_ import MystRenderer
1212
from autodoc2.render.rst_ import RstRenderer
1313
from autodoc2.utils import yield_modules
14+
import docutils
1415
import pytest
1516
import sphinx
1617
from sphinx.testing.util import SphinxTestApp
@@ -248,6 +249,13 @@ def test_sphinx_build_directives(tmp_path: Path, file_regression):
248249
'<desc_parameterlist multi_line_parameter_list="False"',
249250
'<desc_parameterlist multi_line_parameter_list="False" multi_line_trailing_comma="True"',
250251
)
252+
if docutils.__version_info__ < (0, 22):
253+
content = content.replace('="False"', '="0"')
254+
content = content.replace('linenos="True"', 'linenos="1"')
255+
content = content.replace(
256+
'multi_line_trailing_comma="True"', 'multi_line_trailing_comma="1"'
257+
)
258+
content = content.replace('refexplicit="True"', 'refexplicit="1"')
251259
file_regression.check(content, extension=".xml")
252260

253261

tests/test_render/test_sphinx_build_directives.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<section ids="test" names="test">
33
<title>
44
Test
5-
<literal_block highlight_args="{'linenostart': 9}" language="restructuredtext" linenos="True" xml:space="preserve">
5+
<literal_block highlight_args="{'linenostart': 9}" language="restructuredtext" linenos="1" xml:space="preserve">
66
This is a function.
77
<paragraph>
88
This is a function.
@@ -19,13 +19,13 @@
1919
```
2020
````
2121
<index entries="('single',\ 'func()\ (in\ module\ package)',\ 'package.func',\ '',\ None)">
22-
<desc classes="py function" desctype="function" domain="py" no-contents-entry="False" no-index="False" no-index-entry="False" no-typesetting="False" nocontentsentry="False" noindex="False" noindexentry="False" objtype="function">
22+
<desc classes="py function" desctype="function" domain="py" no-contents-entry="0" no-index="0" no-index-entry="0" no-typesetting="0" nocontentsentry="0" noindex="0" noindexentry="0" objtype="function">
2323
<desc_signature _toc_name="func()" _toc_parts="('package', 'func')" class="" classes="sig sig-object" fullname="func" ids="package.func" module="package">
2424
<desc_addname classes="sig-prename descclassname" xml:space="preserve">
2525
package.
2626
<desc_name classes="sig-name descname" xml:space="preserve">
2727
func
28-
<desc_parameterlist multi_line_parameter_list="False" multi_line_trailing_comma="True" xml:space="preserve">
28+
<desc_parameterlist multi_line_parameter_list="0" multi_line_trailing_comma="1" xml:space="preserve">
2929
<desc_parameter xml:space="preserve">
3030
<desc_sig_name classes="n">
3131
a
@@ -34,7 +34,7 @@
3434
<desc_sig_space classes="w">
3535

3636
<desc_sig_name classes="n">
37-
<pending_xref py:class="True" py:module="package" refdomain="py" refspecific="False" reftarget="str" reftype="class">
37+
<pending_xref py:class="True" py:module="package" refdomain="py" refspecific="0" reftarget="str" reftype="class">
3838
str
3939
<desc_parameter xml:space="preserve">
4040
<desc_sig_name classes="n">
@@ -44,10 +44,10 @@
4444
<desc_sig_space classes="w">
4545

4646
<desc_sig_name classes="n">
47-
<pending_xref py:class="True" py:module="package" refdomain="py" refspecific="False" reftarget="int" reftype="class">
47+
<pending_xref py:class="True" py:module="package" refdomain="py" refspecific="0" reftarget="int" reftype="class">
4848
int
4949
<desc_returns xml:space="preserve">
50-
<pending_xref py:class="True" py:module="package" refdomain="py" refspecific="False" reftarget="package.a.c.ac1" reftype="class">
50+
<pending_xref py:class="True" py:module="package" refdomain="py" refspecific="0" reftarget="package.a.c.ac1" reftype="class">
5151
package.a.c.ac1
5252
<desc_content>
5353
<paragraph>
@@ -60,7 +60,7 @@
6060
<row>
6161
<entry>
6262
<paragraph>
63-
<pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="False" reftarget="package.func" reftype="obj" refwarn="False">
63+
<pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="0" reftarget="package.func" reftype="obj" refwarn="0">
6464
<literal classes="xref py py-obj">
6565
package.func
6666
<entry>
@@ -69,7 +69,7 @@
6969
<row>
7070
<entry>
7171
<paragraph>
72-
<pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="True" reftarget="package.a.a1" reftype="obj" refwarn="False">
72+
<pending_xref py:class="True" py:module="True" refdoc="index" refdomain="py" refexplicit="1" reftarget="package.a.a1" reftype="obj" refwarn="0">
7373
<literal classes="xref py py-obj">
7474
package.a1
7575
<entry>

0 commit comments

Comments
 (0)