mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix Python 2 problems in test_build_text
This commit is contained in:
parent
604db47228
commit
e99eb09429
@ -116,18 +116,14 @@ def test_list_items_in_admonition(app, status, warning):
|
|||||||
def test_secnums(app, status, warning):
|
def test_secnums(app, status, warning):
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
contents = (app.outdir / 'contents.txt').text(encoding='utf8')
|
contents = (app.outdir / 'contents.txt').text(encoding='utf8')
|
||||||
expect = (
|
lines = contents.splitlines()
|
||||||
"* Section A\n"
|
assert lines[0] == "* Section A"
|
||||||
"\n"
|
assert lines[1] == ""
|
||||||
"* Section B\n"
|
assert lines[2] == "* Section B"
|
||||||
"\n"
|
assert lines[3] == ""
|
||||||
" * Sub Ba\n"
|
assert lines[4] == " * Sub Ba"
|
||||||
"\n"
|
assert lines[5] == ""
|
||||||
" * Sub Bb\n"
|
assert lines[6] == " * Sub Bb"
|
||||||
"\n"
|
|
||||||
"* 日本語\n"
|
|
||||||
)
|
|
||||||
assert contents == expect
|
|
||||||
doc2 = (app.outdir / 'doc2.txt').text(encoding='utf8')
|
doc2 = (app.outdir / 'doc2.txt').text(encoding='utf8')
|
||||||
expect = (
|
expect = (
|
||||||
"Section B\n"
|
"Section B\n"
|
||||||
@ -146,18 +142,14 @@ def test_secnums(app, status, warning):
|
|||||||
app.config.text_add_secnumbers = True
|
app.config.text_add_secnumbers = True
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
contents = (app.outdir / 'contents.txt').text(encoding='utf8')
|
contents = (app.outdir / 'contents.txt').text(encoding='utf8')
|
||||||
expect = (
|
lines = contents.splitlines()
|
||||||
"* 1. Section A\n"
|
assert lines[0] == "* 1. Section A"
|
||||||
"\n"
|
assert lines[1] == ""
|
||||||
"* 2. Section B\n"
|
assert lines[2] == "* 2. Section B"
|
||||||
"\n"
|
assert lines[3] == ""
|
||||||
" * 2.1. Sub Ba\n"
|
assert lines[4] == " * 2.1. Sub Ba"
|
||||||
"\n"
|
assert lines[5] == ""
|
||||||
" * 2.2. Sub Bb\n"
|
assert lines[6] == " * 2.2. Sub Bb"
|
||||||
"\n"
|
|
||||||
"* 3. 日本語\n"
|
|
||||||
)
|
|
||||||
assert contents == expect
|
|
||||||
doc2 = (app.outdir / 'doc2.txt').text(encoding='utf8')
|
doc2 = (app.outdir / 'doc2.txt').text(encoding='utf8')
|
||||||
expect = (
|
expect = (
|
||||||
"2. Section B\n"
|
"2. Section B\n"
|
||||||
@ -176,18 +168,14 @@ def test_secnums(app, status, warning):
|
|||||||
app.config.text_secnumber_suffix = " "
|
app.config.text_secnumber_suffix = " "
|
||||||
app.builder.build_all()
|
app.builder.build_all()
|
||||||
contents = (app.outdir / 'contents.txt').text(encoding='utf8')
|
contents = (app.outdir / 'contents.txt').text(encoding='utf8')
|
||||||
expect = (
|
lines = contents.splitlines()
|
||||||
"* 1 Section A\n"
|
assert lines[0] == "* 1 Section A"
|
||||||
"\n"
|
assert lines[1] == ""
|
||||||
"* 2 Section B\n"
|
assert lines[2] == "* 2 Section B"
|
||||||
"\n"
|
assert lines[3] == ""
|
||||||
" * 2.1 Sub Ba\n"
|
assert lines[4] == " * 2.1 Sub Ba"
|
||||||
"\n"
|
assert lines[5] == ""
|
||||||
" * 2.2 Sub Bb\n"
|
assert lines[6] == " * 2.2 Sub Bb"
|
||||||
"\n"
|
|
||||||
"* 3 日本語\n"
|
|
||||||
)
|
|
||||||
assert contents == expect
|
|
||||||
doc2 = (app.outdir / 'doc2.txt').text(encoding='utf8')
|
doc2 = (app.outdir / 'doc2.txt').text(encoding='utf8')
|
||||||
expect = (
|
expect = (
|
||||||
"2 Section B\n"
|
"2 Section B\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user