summaryrefslogtreecommitdiff
path: root/tests/test_ext_apidoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_ext_apidoc.py')
-rw-r--r--tests/test_ext_apidoc.py35
1 files changed, 19 insertions, 16 deletions
diff --git a/tests/test_ext_apidoc.py b/tests/test_ext_apidoc.py
index 3033cb450..e8d923b71 100644
--- a/tests/test_ext_apidoc.py
+++ b/tests/test_ext_apidoc.py
@@ -121,15 +121,16 @@ def test_pep_0420_enabled_separate(make_app, apidoc):
with open(outdir / 'a.b.c.rst') as f:
rst = f.read()
- assert ".. toctree::\n\n a.b.c.d\n" in rst
+
+ assert ".. toctree::\n :maxdepth: 4\n\n a.b.c.d\n" in rst
with open(outdir / 'a.b.e.rst') as f:
rst = f.read()
- assert ".. toctree::\n\n a.b.e.f\n" in rst
+ assert ".. toctree::\n :maxdepth: 4\n\n a.b.e.f\n" in rst
with open(outdir / 'a.b.x.rst') as f:
rst = f.read()
- assert ".. toctree::\n\n a.b.x.y\n" in rst
+ assert ".. toctree::\n :maxdepth: 4\n\n a.b.x.y\n" in rst
app = make_app('text', srcdir=outdir)
app.build()
@@ -275,7 +276,7 @@ def test_multibyte_parameters(make_app, apidoc):
assert (outdir / 'conf.py').isfile()
assert (outdir / 'index.rst').isfile()
- conf_py = (outdir / 'conf.py').text()
+ conf_py = (outdir / 'conf.py').read_text()
assert "project = 'プロジェクト名'" in conf_py
assert "author = '著者名'" in conf_py
assert "version = 'バージョン'" in conf_py
@@ -408,13 +409,13 @@ def test_private(tempdir):
# without --private option
apidoc_main(['-o', tempdir, tempdir])
assert (tempdir / 'hello.rst').exists()
- assert ':private-members:' not in (tempdir / 'hello.rst').text()
+ assert ':private-members:' not in (tempdir / 'hello.rst').read_text()
assert not (tempdir / '_world.rst').exists()
# with --private option
apidoc_main(['--private', '-f', '-o', tempdir, tempdir])
assert (tempdir / 'hello.rst').exists()
- assert ':private-members:' in (tempdir / 'hello.rst').text()
+ assert ':private-members:' in (tempdir / 'hello.rst').read_text()
assert (tempdir / '_world.rst').exists()
@@ -426,7 +427,7 @@ def test_toc_file(tempdir):
apidoc_main(['-o', tempdir, tempdir])
assert (outdir / 'modules.rst').exists()
- content = (outdir / 'modules.rst').text()
+ content = (outdir / 'modules.rst').read_text()
assert content == ("test_toc_file0\n"
"==============\n"
"\n"
@@ -442,7 +443,7 @@ def test_module_file(tempdir):
apidoc_main(['-o', tempdir, tempdir])
assert (outdir / 'example.rst').exists()
- content = (outdir / 'example.rst').text()
+ content = (outdir / 'example.rst').read_text()
assert content == ("example module\n"
"==============\n"
"\n"
@@ -458,7 +459,7 @@ def test_module_file_noheadings(tempdir):
apidoc_main(['--no-headings', '-o', tempdir, tempdir])
assert (outdir / 'example.rst').exists()
- content = (outdir / 'example.rst').text()
+ content = (outdir / 'example.rst').read_text()
assert content == (".. automodule:: example\n"
" :members:\n"
" :undoc-members:\n"
@@ -477,7 +478,7 @@ def test_package_file(tempdir):
assert (outdir / 'testpkg.rst').exists()
assert (outdir / 'testpkg.subpkg.rst').exists()
- content = (outdir / 'testpkg.rst').text()
+ content = (outdir / 'testpkg.rst').read_text()
assert content == ("testpkg package\n"
"===============\n"
"\n"
@@ -485,6 +486,7 @@ def test_package_file(tempdir):
"-----------\n"
"\n"
".. toctree::\n"
+ " :maxdepth: 4\n"
"\n"
" testpkg.subpkg\n"
"\n"
@@ -516,7 +518,7 @@ def test_package_file(tempdir):
" :undoc-members:\n"
" :show-inheritance:\n")
- content = (outdir / 'testpkg.subpkg.rst').text()
+ content = (outdir / 'testpkg.subpkg.rst').read_text()
assert content == ("testpkg.subpkg package\n"
"======================\n"
"\n"
@@ -538,7 +540,7 @@ def test_package_file_separate(tempdir):
assert (outdir / 'testpkg.rst').exists()
assert (outdir / 'testpkg.example.rst').exists()
- content = (outdir / 'testpkg.rst').text()
+ content = (outdir / 'testpkg.rst').read_text()
assert content == ("testpkg package\n"
"===============\n"
"\n"
@@ -546,6 +548,7 @@ def test_package_file_separate(tempdir):
"----------\n"
"\n"
".. toctree::\n"
+ " :maxdepth: 4\n"
"\n"
" testpkg.example\n"
"\n"
@@ -557,7 +560,7 @@ def test_package_file_separate(tempdir):
" :undoc-members:\n"
" :show-inheritance:\n")
- content = (outdir / 'testpkg.example.rst').text()
+ content = (outdir / 'testpkg.example.rst').read_text()
assert content == ("testpkg.example module\n"
"======================\n"
"\n"
@@ -574,7 +577,7 @@ def test_package_file_module_first(tempdir):
(outdir / 'testpkg' / 'example.py').write_text('')
apidoc_main(['--module-first', '-o', tempdir, tempdir])
- content = (outdir / 'testpkg.rst').text()
+ content = (outdir / 'testpkg.rst').read_text()
assert content == ("testpkg package\n"
"===============\n"
"\n"
@@ -603,7 +606,7 @@ def test_package_file_without_submodules(tempdir):
apidoc_main(['-o', tempdir, tempdir / 'testpkg'])
assert (outdir / 'testpkg.rst').exists()
- content = (outdir / 'testpkg.rst').text()
+ content = (outdir / 'testpkg.rst').read_text()
assert content == ("testpkg package\n"
"===============\n"
"\n"
@@ -623,7 +626,7 @@ def test_namespace_package_file(tempdir):
apidoc_main(['--implicit-namespace', '-o', tempdir, tempdir / 'testpkg'])
assert (outdir / 'testpkg.rst').exists()
- content = (outdir / 'testpkg.rst').text()
+ content = (outdir / 'testpkg.rst').read_text()
assert content == ("testpkg namespace\n"
"=================\n"
"\n"