Skip to content

Commit

Permalink
Update test_captioned_code_block for latest Docutils (#11551)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
  • Loading branch information
mitya57 and AA-Turner committed Aug 5, 2023
1 parent 062a2e1 commit 8a990db
Showing 1 changed file with 35 additions and 14 deletions.
49 changes: 35 additions & 14 deletions tests/test_build_manpage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test the build process with manpage builder with the test root."""

import docutils
import pytest

from sphinx.builders.manpage import default_man_pages
Expand Down Expand Up @@ -51,20 +52,40 @@ def test_captioned_code_block(app, status, warning):
app.builder.build_all()
content = (app.outdir / 'python.1').read_text(encoding='utf8')

assert ('.sp\n'
'caption \\fItest\\fP rb\n'
'.INDENT 0.0\n'
'.INDENT 3.5\n'
'.sp\n'
'.nf\n'
'.ft C\n'
'def ruby?\n'
' false\n'
'end\n'
'.ft P\n'
'.fi\n'
'.UNINDENT\n'
'.UNINDENT\n' in content)
if docutils.__version_info__[:2] < (0, 21):
expected = """\
.sp
caption \\fItest\\fP rb
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
def ruby?
false
end
.ft P
.fi
.UNINDENT
.UNINDENT
"""
else:
expected = """\
.sp
caption \\fItest\\fP rb
.INDENT 0.0
.INDENT 3.5
.sp
.EX
def ruby?
false
end
.EE
.UNINDENT
.UNINDENT
"""

assert expected in content


def test_default_man_pages():
Expand Down

0 comments on commit 8a990db

Please sign in to comment.