From cf7da1843c45a4c2df7a749f7886a2d2ba0ee92a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 19:25:40 +0200 Subject: Adding upstream version 7.2.6. Signed-off-by: Daniel Baumann --- tests/__init__.py | 0 tests/certs/cert.pem | 50 + tests/conftest.py | 40 + tests/ext_napoleon_pep526_data_google.py | 16 + tests/ext_napoleon_pep526_data_numpy.py | 20 + tests/js/documentation_options.js | 1 + tests/js/searchtools.js | 62 + tests/js/sphinx_highlight.js | 39 + tests/roots/test-add_enumerable_node/conf.py | 7 + .../test-add_enumerable_node/enumerable_node.py | 62 + tests/roots/test-add_enumerable_node/index.rst | 48 + tests/roots/test-add_enumerable_node/rimg.png | Bin 0 -> 120 bytes .../conf.py | 17 + .../source_parser.py | 10 + tests/roots/test-add_source_parser/conf.py | 8 + .../roots/test-add_source_parser/source_parser.py | 10 + tests/roots/test-api-set-translator/conf.py | 72 + tests/roots/test-api-set-translator/index.rst | 3 + tests/roots/test-api-set-translator/nonext/conf.py | 6 + tests/roots/test-api-set-translator/translator.py | 5 + .../halibut.cpython-38-x86_64-linux-gnu.so | 0 .../fish_licence/halibut.pyx | 0 tests/roots/test-apidoc-pep420/a/b/c/__init__.py | 1 + tests/roots/test-apidoc-pep420/a/b/c/d.py | 1 + tests/roots/test-apidoc-pep420/a/b/e/__init__.py | 0 tests/roots/test-apidoc-pep420/a/b/e/f.py | 1 + tests/roots/test-apidoc-pep420/a/b/x/y.py | 1 + .../parent/__init__.py | 0 .../parent/child/__init__.py | 0 .../parent/child/foo.py | 1 + tests/roots/test-apidoc-toc/mypackage/__init__.py | 0 tests/roots/test-apidoc-toc/mypackage/main.py | 15 + .../roots/test-apidoc-toc/mypackage/no_init/foo.py | 1 + .../test-apidoc-toc/mypackage/resource/__init__.py | 0 .../mypackage/resource/resource.txt | 1 + .../mypackage/something/__init__.py | 1 + .../package_/__init__.py | 1 + .../package_/module_.py | 9 + tests/roots/test-autosummary/conf.py | 12 + tests/roots/test-autosummary/dummy_module.py | 85 + tests/roots/test-autosummary/index.rst | 8 + tests/roots/test-autosummary/sphinx.rst | 31 + tests/roots/test-autosummary/underscore_module_.py | 15 + tests/roots/test-basic/conf.py | 3 + tests/roots/test-basic/index.rst | 31 + .../_themes/mytheme/_static/extra.css | 0 .../_themes/mytheme/_static/mytheme.css | 0 .../_themes/mytheme/theme.conf | 3 + .../conf.py | 2 + .../index.rst | 2 + tests/roots/test-build-html-translator/conf.py | 16 + tests/roots/test-build-html-translator/index.rst | 24 + tests/roots/test-build-text/conf.py | 2 + tests/roots/test-build-text/doc1.txt | 2 + tests/roots/test-build-text/doc2.txt | 9 + tests/roots/test-build-text/index.txt | 11 + tests/roots/test-build-text/lineblock.txt | 6 + tests/roots/test-build-text/listitems.txt | 4 + tests/roots/test-build-text/maxwidth.txt | 6 + tests/roots/test-build-text/nonascii_maxwidth.txt | 5 + tests/roots/test-build-text/nonascii_table.txt | 7 + tests/roots/test-build-text/nonascii_title.txt | 2 + tests/roots/test-build-text/table.txt | 7 + tests/roots/test-build-text/table_colspan.txt | 7 + .../test-build-text/table_colspan_and_rowspan.txt | 7 + tests/roots/test-build-text/table_colspan_left.txt | 7 + tests/roots/test-build-text/table_rowspan.txt | 7 + tests/roots/test-builder-dirhtml/bar.rst | 4 + tests/roots/test-builder-dirhtml/conf.py | 0 tests/roots/test-builder-dirhtml/foo/foo_1.rst | 4 + tests/roots/test-builder-dirhtml/foo/foo_2.rst | 4 + tests/roots/test-builder-dirhtml/foo/index.rst | 9 + tests/roots/test-builder-dirhtml/index.rst | 9 + .../test-builder-gettext-dont-rebuild-mo/bom.rst | 5 + .../test-builder-gettext-dont-rebuild-mo/conf.py | 1 + .../test-builder-gettext-dont-rebuild-mo/index.rst | 6 + .../xx/LC_MESSAGES/bom.po | 12 + tests/roots/test-changes/base.rst | 20 + tests/roots/test-changes/c-api.rst | 24 + tests/roots/test-changes/conf.py | 4 + tests/roots/test-changes/contents.rst | 13 + tests/roots/test-changes/library/utils.rst | 25 + tests/roots/test-circular/conf.py | 1 + tests/roots/test-circular/index.rst | 4 + tests/roots/test-circular/sub.rst | 3 + tests/roots/test-config/conf.py | 3 + tests/roots/test-copyright-multiline/conf.py | 9 + tests/roots/test-copyright-multiline/index.rst | 3 + tests/roots/test-correct-year/conf.py | 1 + tests/roots/test-correct-year/index.rst | 4 + tests/roots/test-default_role/conf.py | 0 tests/roots/test-default_role/foo.rst | 4 + tests/roots/test-default_role/index.rst | 6 + tests/roots/test-directive-code/caption.rst | 52 + tests/roots/test-directive-code/classes.rst | 21 + tests/roots/test-directive-code/conf.py | 2 + tests/roots/test-directive-code/dedent.rst | 64 + tests/roots/test-directive-code/emphasize.rst | 7 + tests/roots/test-directive-code/empty.inc | 3 + tests/roots/test-directive-code/error.inc | 1 + tests/roots/test-directive-code/force.rst | 16 + tests/roots/test-directive-code/highlight.rst | 20 + tests/roots/test-directive-code/index.rst | 25 + tests/roots/test-directive-code/linenos.rst | 18 + .../roots/test-directive-code/linenothreshold.rst | 23 + tests/roots/test-directive-code/literal-diff.inc | 13 + tests/roots/test-directive-code/literal-short.inc | 3 + tests/roots/test-directive-code/literal.inc | 13 + tests/roots/test-directive-code/namedblocks.rst | 28 + tests/roots/test-directive-code/py-decorators.inc | 15 + tests/roots/test-directive-code/py-decorators.rst | 17 + tests/roots/test-directive-code/python.rst | 13 + tests/roots/test-directive-code/target.py | 26 + tests/roots/test-directive-csv-table/conf.py | 0 tests/roots/test-directive-csv-table/example.csv | 1 + .../test-directive-csv-table/subdir/example.csv | 1 + tests/roots/test-directive-include/bar.txt | 1 + tests/roots/test-directive-include/baz/baz.rst | 6 + tests/roots/test-directive-include/conf.py | 2 + tests/roots/test-directive-include/foo.rst | 1 + tests/roots/test-directive-include/text.txt | 1 + tests/roots/test-directive-only/conf.py | 2 + tests/roots/test-directive-only/index.rst | 6 + tests/roots/test-directive-only/only.rst | 203 ++ tests/roots/test-directives-raw/conf.py | 0 tests/roots/test-directives-raw/index.rst | 40 + tests/roots/test-docutilsconf/conf.py | 0 tests/roots/test-docutilsconf/docutils.conf | 0 tests/roots/test-docutilsconf/index.rst | 6 + .../conf.py | 1 + .../index.rst | 4 + tests/roots/test-domain-c-intersphinx/conf.py | 4 + tests/roots/test-domain-c-intersphinx/index.rst | 62 + tests/roots/test-domain-c/anon-dup-decl.rst | 7 + tests/roots/test-domain-c/conf.py | 1 + tests/roots/test-domain-c/field-role.rst | 4 + .../roots/test-domain-c/function_param_target.rst | 7 + tests/roots/test-domain-c/index.rst | 54 + tests/roots/test-domain-c/namespace.rst | 21 + tests/roots/test-domain-c/ns_lookup.rst | 13 + .../conf.py | 1 + .../index.rst | 4 + tests/roots/test-domain-cpp-intersphinx/conf.py | 4 + tests/roots/test-domain-cpp-intersphinx/index.rst | 112 + tests/roots/test-domain-cpp/anon-dup-decl.rst | 4 + tests/roots/test-domain-cpp/any-role.rst | 17 + tests/roots/test-domain-cpp/backslash.rst | 1 + tests/roots/test-domain-cpp/conf.py | 1 + tests/roots/test-domain-cpp/field-role.rst | 5 + tests/roots/test-domain-cpp/index.rst | 53 + .../roots/test-domain-cpp/lookup-key-overload.rst | 8 + tests/roots/test-domain-cpp/multi-decl-lookup.rst | 24 + tests/roots/test-domain-cpp/roles-targets-ok.rst | 170 ++ tests/roots/test-domain-cpp/roles-targets-warn.rst | 158 ++ tests/roots/test-domain-cpp/roles.rst | 17 + tests/roots/test-domain-cpp/roles2.rst | 5 + tests/roots/test-domain-cpp/semicolon.rst | 14 + .../warn-template-param-qualified-name.rst | 11 + tests/roots/test-domain-cpp/xref_consistency.rst | 12 + .../conf.py | 1 + .../index.rst | 6 + tests/roots/test-domain-js/conf.py | 1 + tests/roots/test-domain-js/index.rst | 7 + tests/roots/test-domain-js/module.rst | 27 + tests/roots/test-domain-js/roles.rst | 48 + .../conf.py | 1 + .../index.rst | 6 + .../conf.py | 1 + .../index.rst | 12 + tests/roots/test-domain-py-xref-warning/conf.py | 0 tests/roots/test-domain-py-xref-warning/index.rst | 7 + tests/roots/test-domain-py/abbr.rst | 10 + tests/roots/test-domain-py/canonical.rst | 12 + tests/roots/test-domain-py/conf.py | 1 + tests/roots/test-domain-py/index.rst | 10 + tests/roots/test-domain-py/module.rst | 60 + tests/roots/test-domain-py/module_option.rst | 25 + tests/roots/test-domain-py/roles.rst | 48 + .../base_themes_dir/base_theme1/theme.conf | 2 + .../base_themes_dir/base_theme2/theme.conf | 2 + tests/roots/test-double-inheriting-theme/conf.py | 4 + tests/roots/test-double-inheriting-theme/index.rst | 3 + .../test-environment-record-dependencies/api.rst | 4 + .../test-environment-record-dependencies/conf.py | 5 + .../example_module.py | 2 + .../test-environment-record-dependencies/index.rst | 3 + tests/roots/test-epub-anchor-id/conf.py | 2 + tests/roots/test-epub-anchor-id/index.rst | 13 + tests/roots/test-ext-autodoc/autodoc_dummy_bar.py | 6 + .../roots/test-ext-autodoc/autodoc_dummy_module.py | 6 + tests/roots/test-ext-autodoc/bug2437/__init__.py | 0 .../test-ext-autodoc/bug2437/autodoc_dummy_foo.py | 3 + .../test-ext-autodoc/circular_import/__init__.py | 1 + tests/roots/test-ext-autodoc/circular_import/a.py | 1 + tests/roots/test-ext-autodoc/circular_import/b.py | 4 + tests/roots/test-ext-autodoc/circular_import/c.py | 6 + tests/roots/test-ext-autodoc/conf.py | 15 + tests/roots/test-ext-autodoc/index.rst | 15 + .../roots/test-ext-autodoc/target/TYPE_CHECKING.py | 16 + tests/roots/test-ext-autodoc/target/__init__.py | 204 ++ .../target/_functions_to_import.py | 8 + .../test-ext-autodoc/target/abstractmethods.py | 29 + tests/roots/test-ext-autodoc/target/annotated.py | 8 + .../test-ext-autodoc/target/autoclass_content.py | 47 + .../target/autodoc_type_aliases.py | 49 + .../roots/test-ext-autodoc/target/bound_method.py | 7 + .../test-ext-autodoc/target/cached_property.py | 12 + tests/roots/test-ext-autodoc/target/callable.py | 13 + .../test-ext-autodoc/target/canonical/__init__.py | 1 + .../test-ext-autodoc/target/canonical/original.py | 15 + tests/roots/test-ext-autodoc/target/classes.py | 44 + tests/roots/test-ext-autodoc/target/coroutine.py | 37 + tests/roots/test-ext-autodoc/target/cython.pyx | 13 + tests/roots/test-ext-autodoc/target/decorator.py | 53 + tests/roots/test-ext-autodoc/target/descriptor.py | 31 + .../test-ext-autodoc/target/docstring_signature.py | 33 + tests/roots/test-ext-autodoc/target/empty_all.py | 16 + tests/roots/test-ext-autodoc/target/enums.py | 23 + tests/roots/test-ext-autodoc/target/final.py | 16 + tests/roots/test-ext-autodoc/target/functions.py | 19 + .../roots/test-ext-autodoc/target/generic_class.py | 13 + .../roots/test-ext-autodoc/target/genericalias.py | 16 + tests/roots/test-ext-autodoc/target/hide_value.py | 19 + .../test-ext-autodoc/target/imported_members.py | 1 + tests/roots/test-ext-autodoc/target/inheritance.py | 25 + .../test-ext-autodoc/target/instance_variable.py | 11 + tests/roots/test-ext-autodoc/target/literal.py | 24 + tests/roots/test-ext-autodoc/target/metadata.py | 2 + tests/roots/test-ext-autodoc/target/methods.py | 29 + tests/roots/test-ext-autodoc/target/module.py | 14 + .../target/name_conflict/__init__.py | 6 + .../test-ext-autodoc/target/name_conflict/foo.py | 2 + .../roots/test-ext-autodoc/target/name_mangling.py | 11 + tests/roots/test-ext-autodoc/target/need_mocks.py | 42 + tests/roots/test-ext-autodoc/target/overload.py | 90 + tests/roots/test-ext-autodoc/target/overload2.py | 5 + .../test-ext-autodoc/target/partialfunction.py | 12 + .../roots/test-ext-autodoc/target/partialmethod.py | 17 + tests/roots/test-ext-autodoc/target/pep570.py | 0 tests/roots/test-ext-autodoc/target/pep604.py | 16 + .../test-ext-autodoc/target/preserve_defaults.py | 60 + .../target/preserve_defaults_special_constructs.py | 50 + tests/roots/test-ext-autodoc/target/private.py | 27 + .../test-ext-autodoc/target/process_docstring.py | 8 + tests/roots/test-ext-autodoc/target/properties.py | 22 + .../test-ext-autodoc/target/singledispatch.py | 36 + .../target/singledispatchmethod.py | 27 + tests/roots/test-ext-autodoc/target/slots.py | 22 + tests/roots/test-ext-autodoc/target/sort_by_all.py | 25 + tests/roots/test-ext-autodoc/target/typed_vars.py | 34 + tests/roots/test-ext-autodoc/target/typehints.py | 105 + tests/roots/test-ext-autodoc/target/typevar.py | 32 + .../target/uninitialized_attributes.py | 8 + .../test-ext-autodoc/target/wrappedfunction.py | 17 + .../conf.py | 2 + .../index.rst | 37 + tests/roots/test-ext-autosectionlabel/conf.py | 1 + tests/roots/test-ext-autosectionlabel/index.rst | 37 + .../autosummary_dummy_module.py | 23 + .../test-ext-autosummary-filename-map/conf.py | 11 + .../test-ext-autosummary-filename-map/index.rst | 9 + .../autosummary_dummy_package/__init__.py | 1 + .../autosummary_dummy_module.py | 8 + .../test-ext-autosummary-imported_members/conf.py | 8 + .../index.rst | 7 + .../test-ext-autosummary-mock_imports/conf.py | 8 + .../roots/test-ext-autosummary-mock_imports/foo.py | 6 + .../test-ext-autosummary-mock_imports/index.rst | 7 + .../autosummary_dummy_package_all/__init__.py | 13 + .../autosummary_dummy_module.py | 20 + .../extra_dummy_module.py | 20 + .../roots/test-ext-autosummary-module_all/conf.py | 8 + .../test-ext-autosummary-module_all/index.rst | 8 + tests/roots/test-ext-autosummary-recursive/conf.py | 7 + .../roots/test-ext-autosummary-recursive/index.rst | 15 + .../package/__init__.py | 0 .../package/module.py | 13 + .../package/module_importfail.py | 2 + .../package/package/__init__.py | 0 .../package/package/module.py | 13 + .../package2/__init__.py | 0 .../package2/module.py | 13 + .../roots/test-ext-autosummary-skip-member/conf.py | 20 + .../test-ext-autosummary-skip-member/index.rst | 4 + .../test-ext-autosummary-skip-member/target.py | 14 + .../_templates/empty.rst | 1 + tests/roots/test-ext-autosummary-template/conf.py | 10 + .../roots/test-ext-autosummary-template/index.rst | 5 + .../roots/test-ext-autosummary-template/target.py | 2 + .../autosummary_class_module.py | 2 + .../autosummary_dummy_inherited_module.py | 13 + .../autosummary_dummy_module.py | 68 + .../test-ext-autosummary/autosummary_importfail.py | 2 + tests/roots/test-ext-autosummary/conf.py | 10 + tests/roots/test-ext-autosummary/index.rst | 18 + tests/roots/test-ext-coverage/conf.py | 12 + tests/roots/test-ext-coverage/coverage_ignored.py | 22 + .../test-ext-coverage/coverage_not_ignored.py | 22 + tests/roots/test-ext-coverage/index.rst | 6 + tests/roots/test-ext-doctest-skipif/conf.py | 16 + tests/roots/test-ext-doctest-skipif/skipif.txt | 81 + tests/roots/test-ext-doctest-with-autodoc/conf.py | 7 + .../test-ext-doctest-with-autodoc/dir/__init__.py | 0 .../roots/test-ext-doctest-with-autodoc/dir/bar.py | 4 + .../test-ext-doctest-with-autodoc/dir/inner.rst | 4 + tests/roots/test-ext-doctest-with-autodoc/foo.py | 5 + .../roots/test-ext-doctest-with-autodoc/index.rst | 4 + tests/roots/test-ext-doctest/conf.py | 6 + tests/roots/test-ext-doctest/doctest.txt | 163 ++ .../conf.py | 6 + .../index.rst | 24 + .../roots/test-ext-extlinks-hardcoded-urls/conf.py | 3 + .../test-ext-extlinks-hardcoded-urls/index.rst | 28 + tests/roots/test-ext-githubpages/conf.py | 1 + tests/roots/test-ext-githubpages/index.rst | 3 + .../test-ext-graphviz/_static/images/test.svg | 8 + tests/roots/test-ext-graphviz/conf.py | 3 + tests/roots/test-ext-graphviz/graph.dot | 3 + tests/roots/test-ext-graphviz/graph.xx.dot | 3 + tests/roots/test-ext-graphviz/index.rst | 43 + tests/roots/test-ext-ifconfig/conf.py | 10 + tests/roots/test-ext-ifconfig/index.rst | 21 + tests/roots/test-ext-imgconverter/conf.py | 1 + tests/roots/test-ext-imgconverter/img.pdf | Bin 0 -> 141783 bytes tests/roots/test-ext-imgconverter/index.rst | 5 + tests/roots/test-ext-imgconverter/svgimg.svg | 4 + tests/roots/test-ext-imgmockconverter/1/svgimg.svg | 3 + tests/roots/test-ext-imgmockconverter/2/svgimg.svg | 4 + tests/roots/test-ext-imgmockconverter/conf.py | 5 + tests/roots/test-ext-imgmockconverter/index.rst | 6 + .../test-ext-imgmockconverter/mocksvgconverter.py | 39 + tests/roots/test-ext-inheritance_diagram/conf.py | 6 + .../example/__init__.py | 1 + .../test-ext-inheritance_diagram/example/sphinx.py | 5 + .../test-ext-inheritance_diagram/external/other.py | 5 + tests/roots/test-ext-inheritance_diagram/index.rst | 18 + .../test-ext-inheritance_diagram/subdir/page1.rst | 9 + .../test-ext-inheritance_diagram/subdir/page2.rst | 5 + tests/roots/test-ext-inheritance_diagram/test.py | 22 + tests/roots/test-ext-intersphinx-cppdomain/conf.py | 1 + .../roots/test-ext-intersphinx-cppdomain/index.rst | 8 + tests/roots/test-ext-intersphinx-role/conf.py | 3 + tests/roots/test-ext-intersphinx-role/index.rst | 44 + tests/roots/test-ext-math-compat/conf.py | 20 + tests/roots/test-ext-math-compat/index.rst | 21 + tests/roots/test-ext-math-simple/conf.py | 0 tests/roots/test-ext-math-simple/index.rst | 4 + tests/roots/test-ext-math/conf.py | 0 tests/roots/test-ext-math/index.rst | 25 + tests/roots/test-ext-math/math.rst | 31 + tests/roots/test-ext-math/nomath.rst | 0 tests/roots/test-ext-math/page.rst | 9 + tests/roots/test-ext-napoleon/conf.py | 5 + tests/roots/test-ext-napoleon/index.rst | 6 + .../roots/test-ext-napoleon/mypackage/__init__.py | 0 .../roots/test-ext-napoleon/mypackage/typehints.py | 11 + tests/roots/test-ext-napoleon/typehints.rst | 5 + tests/roots/test-ext-todo/bar.rst | 4 + tests/roots/test-ext-todo/conf.py | 1 + tests/roots/test-ext-todo/foo.rst | 10 + tests/roots/test-ext-todo/index.rst | 11 + tests/roots/test-ext-viewcode-find/conf.py | 3 + tests/roots/test-ext-viewcode-find/index.rst | 38 + .../not_a_package/__init__.py | 1 + .../not_a_package/submodule.py | 31 + tests/roots/test-ext-viewcode/conf.py | 24 + tests/roots/test-ext-viewcode/index.rst | 39 + tests/roots/test-ext-viewcode/objects.rst | 169 ++ tests/roots/test-ext-viewcode/spam/__init__.py | 2 + tests/roots/test-ext-viewcode/spam/mod1.py | 30 + tests/roots/test-ext-viewcode/spam/mod2.py | 22 + tests/roots/test-ext-viewcode/spam/mod3.py | 3 + tests/roots/test-extensions/conf.py | 4 + tests/roots/test-extensions/read_parallel.py | 4 + tests/roots/test-extensions/read_serial.py | 4 + tests/roots/test-extensions/write_parallel.py | 4 + tests/roots/test-extensions/write_serial.py | 4 + tests/roots/test-footnotes/bar.rst | 6 + tests/roots/test-footnotes/baz.rst | 6 + tests/roots/test-footnotes/conf.py | 1 + tests/roots/test-footnotes/index.rst | 188 ++ tests/roots/test-footnotes/rimg.png | Bin 0 -> 120 bytes .../_templates/template1.html | 5 + .../_templates/template2.html | 5 + tests/roots/test-gettext-template/conf.py | 1 + tests/roots/test-gettext-template/index.rst | 0 tests/roots/test-glossary/conf.py | 0 tests/roots/test-glossary/index.rst | 22 + tests/roots/test-highlight_options/conf.py | 4 + tests/roots/test-highlight_options/index.rst | 14 + tests/roots/test-html_assets/conf.py | 12 + tests/roots/test-html_assets/extra/.htaccess | 0 tests/roots/test-html_assets/extra/.htpasswd | 0 tests/roots/test-html_assets/extra/API.html_t | 1 + tests/roots/test-html_assets/extra/css/style.css | 0 tests/roots/test-html_assets/extra/index.rst | 0 tests/roots/test-html_assets/extra/rimg.png | Bin 0 -> 120 bytes .../roots/test-html_assets/extra/subdir/.htaccess | 0 .../roots/test-html_assets/extra/subdir/.htpasswd | 0 tests/roots/test-html_assets/index.rst | 3 + tests/roots/test-html_assets/static/.htaccess | 0 tests/roots/test-html_assets/static/.htpasswd | 0 tests/roots/test-html_assets/static/API.html_t | 1 + tests/roots/test-html_assets/static/css/style.css | 0 tests/roots/test-html_assets/static/index.rst | 0 tests/roots/test-html_assets/static/js/custom.js | 0 tests/roots/test-html_assets/static/rimg.png | Bin 0 -> 120 bytes .../roots/test-html_assets/static/subdir/.htaccess | 0 .../roots/test-html_assets/static/subdir/.htpasswd | 0 .../test-html_assets/subdir/_build/index.html | 0 tests/roots/test-html_assets/subdir/background.png | Bin 0 -> 120 bytes tests/roots/test-html_entity/conf.py | 2 + tests/roots/test-html_entity/index.rst | 31 + tests/roots/test-html_file_checksum/conf.py | 1 + tests/roots/test-html_file_checksum/index.rst | 0 .../roots/test-html_file_checksum/static/empty.js | 0 .../roots/test-html_file_checksum/static/script.js | 1 + .../static/stylesheet-a.css | 1 + .../static/stylesheet-b.css | 1 + tests/roots/test-html_scaled_image_link/conf.py | 0 tests/roots/test-html_scaled_image_link/img.png | Bin 0 -> 66247 bytes tests/roots/test-html_scaled_image_link/index.rst | 11 + tests/roots/test-html_signaturereturn_icon/conf.py | 1 + .../roots/test-html_signaturereturn_icon/index.rst | 4 + tests/roots/test-html_style/_static/default.css | 0 tests/roots/test-html_style/conf.py | 2 + tests/roots/test-html_style/index.rst | 2 + tests/roots/test-image-escape/conf.py | 0 tests/roots/test-image-escape/img_#1.png | Bin 0 -> 66247 bytes tests/roots/test-image-escape/index.rst | 5 + tests/roots/test-image-in-parsed-literal/conf.py | 9 + tests/roots/test-image-in-parsed-literal/index.rst | 9 + tests/roots/test-image-in-parsed-literal/pic.png | Bin 0 -> 120 bytes tests/roots/test-image-in-section/conf.py | 8 + tests/roots/test-image-in-section/index.rst | 22 + tests/roots/test-image-in-section/pic.png | Bin 0 -> 120 bytes tests/roots/test-images/conf.py | 0 tests/roots/test-images/img.gif | Bin 0 -> 24976 bytes tests/roots/test-images/img.ja.png | Bin 0 -> 66247 bytes tests/roots/test-images/img.pdf | Bin 0 -> 141783 bytes tests/roots/test-images/img.png | Bin 0 -> 66247 bytes tests/roots/test-images/img.zh.png | Bin 0 -> 66247 bytes tests/roots/test-images/index.rst | 29 + tests/roots/test-images/rimg.png | Bin 0 -> 120 bytes tests/roots/test-images/rimg.png.xx | Bin 0 -> 218 bytes tests/roots/test-images/rimg.xx.png | Bin 0 -> 120 bytes tests/roots/test-images/subdir/index.rst | 10 + tests/roots/test-images/subdir/rimg.png | Bin 0 -> 120 bytes tests/roots/test-images/subdir/rimg.xx.png | Bin 0 -> 120 bytes tests/roots/test-images/subdir/svgimg.pdf | Bin 0 -> 141783 bytes tests/roots/test-images/subdir/svgimg.svg | 4 + tests/roots/test-images/subdir/svgimg.xx.svg | 4 + "tests/roots/test-images/testim\303\244ge.png" | Bin 0 -> 66247 bytes tests/roots/test-index_on_title/conf.py | 0 tests/roots/test-index_on_title/contents.rst | 5 + tests/roots/test-inheritance/basic_diagram.rst | 5 + tests/roots/test-inheritance/conf.py | 7 + .../diagram_module_w_2_top_classes.rst | 6 + .../test-inheritance/diagram_w_1_top_class.rst | 7 + .../test-inheritance/diagram_w_2_top_classes.rst | 9 + .../test-inheritance/diagram_w_nested_classes.rst | 5 + tests/roots/test-inheritance/diagram_w_parts.rst | 7 + tests/roots/test-inheritance/dummy/__init__.py | 0 tests/roots/test-inheritance/dummy/test.py | 35 + tests/roots/test-inheritance/dummy/test_nested.py | 11 + tests/roots/test-inheritance/index.rst | 4 + tests/roots/test-intl/_templates/contents.html | 10 + tests/roots/test-intl/admonitions.txt | 50 + tests/roots/test-intl/bom.txt | 5 + tests/roots/test-intl/conf.py | 8 + tests/roots/test-intl/definition_terms.txt | 16 + tests/roots/test-intl/docfields.txt | 46 + tests/roots/test-intl/external_links.txt | 35 + tests/roots/test-intl/figure.txt | 53 + tests/roots/test-intl/footnote.txt | 14 + tests/roots/test-intl/glossary_terms.txt | 29 + .../test-intl/glossary_terms_inconsistency.txt | 6 + tests/roots/test-intl/i18n.png | Bin 0 -> 66247 bytes tests/roots/test-intl/img.png | Bin 0 -> 66247 bytes tests/roots/test-intl/index.txt | 40 + tests/roots/test-intl/index_entries.txt | 24 + tests/roots/test-intl/label_target.txt | 67 + tests/roots/test-intl/literalblock.txt | 71 + tests/roots/test-intl/noqa.txt | 16 + tests/roots/test-intl/only.txt | 14 + tests/roots/test-intl/raw.txt | 8 + tests/roots/test-intl/refs.txt | 48 + tests/roots/test-intl/refs_inconsistency.txt | 13 + tests/roots/test-intl/refs_python_domain.txt | 15 + tests/roots/test-intl/role_xref.txt | 40 + tests/roots/test-intl/rubric.txt | 14 + tests/roots/test-intl/section.txt | 8 + tests/roots/test-intl/seealso.txt | 15 + tests/roots/test-intl/subdir/index.txt | 2 + tests/roots/test-intl/table.txt | 20 + tests/roots/test-intl/toctree.txt | 10 + tests/roots/test-intl/topic.txt | 13 + tests/roots/test-intl/translation_progress.txt | 40 + tests/roots/test-intl/versionchange.txt | 16 + tests/roots/test-intl/warnings.txt | 5 + .../roots/test-intl/xx/LC_MESSAGES/admonitions.po | 84 + tests/roots/test-intl/xx/LC_MESSAGES/bom.po | 12 + .../test-intl/xx/LC_MESSAGES/definition_terms.po | 47 + tests/roots/test-intl/xx/LC_MESSAGES/docfields.po | 39 + .../test-intl/xx/LC_MESSAGES/external_links.po | 47 + tests/roots/test-intl/xx/LC_MESSAGES/figure.po | 57 + tests/roots/test-intl/xx/LC_MESSAGES/footnote.po | 40 + .../test-intl/xx/LC_MESSAGES/glossary_terms.po | 59 + .../xx/LC_MESSAGES/glossary_terms_inconsistency.po | 23 + tests/roots/test-intl/xx/LC_MESSAGES/index.po | 29 + .../test-intl/xx/LC_MESSAGES/index_entries.po | 77 + .../roots/test-intl/xx/LC_MESSAGES/label_target.po | 66 + .../roots/test-intl/xx/LC_MESSAGES/literalblock.po | 103 + tests/roots/test-intl/xx/LC_MESSAGES/noqa.po | 46 + tests/roots/test-intl/xx/LC_MESSAGES/only.po | 29 + tests/roots/test-intl/xx/LC_MESSAGES/raw.po | 21 + tests/roots/test-intl/xx/LC_MESSAGES/refs.po | 85 + .../test-intl/xx/LC_MESSAGES/refs_inconsistency.po | 39 + .../test-intl/xx/LC_MESSAGES/refs_python_domain.po | 25 + tests/roots/test-intl/xx/LC_MESSAGES/role_xref.po | 47 + tests/roots/test-intl/xx/LC_MESSAGES/rubric.po | 29 + tests/roots/test-intl/xx/LC_MESSAGES/section.po | 28 + tests/roots/test-intl/xx/LC_MESSAGES/seealso.po | 33 + tests/roots/test-intl/xx/LC_MESSAGES/sphinx.po | 23 + tests/roots/test-intl/xx/LC_MESSAGES/table.po | 54 + tests/roots/test-intl/xx/LC_MESSAGES/toctree.po | 31 + tests/roots/test-intl/xx/LC_MESSAGES/topic.po | 31 + .../xx/LC_MESSAGES/translation_progress.po | 57 + .../test-intl/xx/LC_MESSAGES/versionchange.po | 33 + tests/roots/test-intl/xx/LC_MESSAGES/warnings.po | 23 + .../test-intl_substitution_definitions/conf.py | 13 + .../test-intl_substitution_definitions/i18n.png | Bin 0 -> 66247 bytes .../test-intl_substitution_definitions/img.png | Bin 0 -> 66247 bytes .../test-intl_substitution_definitions/index.rst | 10 + .../prolog_epilog_substitution.rst | 12 + .../prolog_epilog_substitution_excluded.rst | 6 + .../xx/LC_MESSAGES/prolog_epilog_substitution.po | 38 + tests/roots/test-keep_warnings/conf.py | 1 + tests/roots/test-keep_warnings/index.rst | 2 + tests/roots/test-latex-babel/bar.rst | 4 + tests/roots/test-latex-babel/conf.py | 5 + tests/roots/test-latex-babel/foo.rst | 4 + tests/roots/test-latex-babel/index.rst | 8 + tests/roots/test-latex-container/conf.py | 0 tests/roots/test-latex-container/index.rst | 4 + tests/roots/test-latex-equations/conf.py | 2 + tests/roots/test-latex-equations/equations.rst | 21 + .../expects/latex-equations.tex | 18 + .../roots/test-latex-figure-in-admonition/conf.py | 1 + .../roots/test-latex-figure-in-admonition/img.png | Bin 0 -> 66247 bytes .../test-latex-figure-in-admonition/index.rst | 9 + tests/roots/test-latex-includegraphics/conf.py | 47 + tests/roots/test-latex-includegraphics/img.png | Bin 0 -> 66247 bytes tests/roots/test-latex-includegraphics/index.rst | 37 + tests/roots/test-latex-includegraphics/sphinx.png | Bin 0 -> 34213 bytes tests/roots/test-latex-includegraphics/tall.png | Bin 0 -> 38192 bytes tests/roots/test-latex-index/conf.py | 0 tests/roots/test-latex-index/index.rst | 16 + .../test-latex-labels-before-module/automodule1.py | 2 + .../automodule2a.py | 2 + .../automodule2b.py | 2 + .../test-latex-labels-before-module/automodule3.py | 2 + .../roots/test-latex-labels-before-module/conf.py | 8 + .../test-latex-labels-before-module/index.rst | 48 + tests/roots/test-latex-labels/conf.py | 0 tests/roots/test-latex-labels/index.rst | 72 + tests/roots/test-latex-labels/otherdoc.rst | 2 + tests/roots/test-latex-numfig/conf.py | 8 + tests/roots/test-latex-numfig/index.rst | 9 + tests/roots/test-latex-numfig/indexhowto.rst | 10 + tests/roots/test-latex-numfig/indexmanual.rst | 13 + .../_mytemplates/latex/longtable.tex_t | 1 + tests/roots/test-latex-table/complex.rst | 58 + tests/roots/test-latex-table/conf.py | 0 .../expects/complex_spanning_cell.tex | 69 + tests/roots/test-latex-table/expects/gridtable.tex | 73 + .../expects/gridtable_with_tabularcolumn.tex | 73 + tests/roots/test-latex-table/expects/longtable.tex | 70 + .../expects/longtable_having_align.tex | 69 + .../expects/longtable_having_caption.tex | 71 + .../expects/longtable_having_problematic_cell.tex | 76 + ...le_having_stub_columns_and_problematic_cell.tex | 81 + .../expects/longtable_having_verbatim.tex | 70 + .../expects/longtable_having_widths.tex | 73 + ...ongtable_having_widths_and_problematic_cell.tex | 76 + .../expects/longtable_with_tabularcolumn.tex | 70 + .../test-latex-table/expects/simple_table.tex | 40 + .../expects/table_having_caption.tex | 44 + .../expects/table_having_problematic_cell.tex | 47 + ...le_having_stub_columns_and_problematic_cell.tex | 49 + ...le_having_threeparagraphs_cell_in_first_col.tex | 26 + .../expects/table_having_verbatim.tex | 41 + .../expects/table_having_widths.tex | 46 + .../table_having_widths_and_problematic_cell.tex | 47 + .../expects/tabular_having_widths.tex | 40 + .../test-latex-table/expects/tabularcolumn.tex | 41 + .../expects/tabulary_having_widths.tex | 40 + tests/roots/test-latex-table/index.rst | 8 + tests/roots/test-latex-table/longtable.rst | 156 ++ tests/roots/test-latex-table/tabular.rst | 173 ++ tests/roots/test-latex-theme/conf.py | 2 + tests/roots/test-latex-theme/index.rst | 2 + .../roots/test-latex-theme/theme/custom/theme.conf | 6 + tests/roots/test-latex-title/conf.py | 4 + tests/roots/test-latex-title/index.rst | 12 + tests/roots/test-latex-unicode/conf.py | 0 tests/roots/test-latex-unicode/index.rst | 7 + .../test-linkcheck-anchors-ignore-for-url/conf.py | 3 + .../index.rst | 7 + tests/roots/test-linkcheck-anchors-ignore/conf.py | 3 + .../roots/test-linkcheck-anchors-ignore/index.rst | 2 + .../br0ken_link.rst | 5 + .../broken_link.rst | 5 + .../roots/test-linkcheck-documents_exclude/conf.py | 6 + .../test-linkcheck-documents_exclude/index.rst | 3 + .../test-linkcheck-localserver-anchor/conf.py | 3 + .../test-linkcheck-localserver-anchor/index.rst | 1 + .../roots/test-linkcheck-localserver-https/conf.py | 2 + .../test-linkcheck-localserver-https/index.rst | 1 + .../conf.py | 2 + .../index.rst | 3 + tests/roots/test-linkcheck-localserver/conf.py | 2 + tests/roots/test-linkcheck-localserver/index.rst | 1 + tests/roots/test-linkcheck-raw-node/conf.py | 2 + tests/roots/test-linkcheck-raw-node/index.rst | 2 + .../roots/test-linkcheck-too-many-retries/conf.py | 3 + .../test-linkcheck-too-many-retries/index.rst | 1 + tests/roots/test-linkcheck/conf.py | 4 + tests/roots/test-linkcheck/links.rst | 14 + tests/roots/test-local-logo/conf.py | 4 + tests/roots/test-local-logo/images/img.png | Bin 0 -> 66247 bytes tests/roots/test-local-logo/index.rst | 31 + .../test-locale/locale1/en/LC_MESSAGES/myext.mo | Bin 0 -> 80 bytes .../test-locale/locale1/en/LC_MESSAGES/myext.po | 2 + .../test-locale/locale1/et/LC_MESSAGES/myext.mo | Bin 0 -> 80 bytes .../test-locale/locale1/et/LC_MESSAGES/myext.po | 2 + .../test-locale/locale2/en/LC_MESSAGES/myext.mo | Bin 0 -> 82 bytes .../test-locale/locale2/en/LC_MESSAGES/myext.po | 2 + tests/roots/test-manpage_url/conf.py | 1 + tests/roots/test-manpage_url/index.rst | 3 + tests/roots/test-markup-citation/conf.py | 3 + tests/roots/test-markup-citation/index.rst | 9 + tests/roots/test-markup-rubric/conf.py | 3 + tests/roots/test-markup-rubric/index.rst | 7 + tests/roots/test-maxlistdepth/conf.py | 5 + tests/roots/test-maxlistdepth/index.rst | 57 + tests/roots/test-metadata/conf.py | 0 tests/roots/test-metadata/index.rst | 46 + tests/roots/test-need-escaped/bar.rst | 2 + tests/roots/test-need-escaped/baz.rst | 2 + tests/roots/test-need-escaped/conf.py | 2 + tests/roots/test-need-escaped/foo.rst | 15 + tests/roots/test-need-escaped/index.rst | 30 + tests/roots/test-need-escaped/quux.rst | 2 + tests/roots/test-need-escaped/qux.rst | 1 + tests/roots/test-nested-enumerated-list/conf.py | 0 tests/roots/test-nested-enumerated-list/index.rst | 21 + tests/roots/test-nested-tables/conf.py | 0 tests/roots/test-nested-tables/index.rst | 16 + tests/roots/test-nitpicky-warnings/conf.py | 1 + tests/roots/test-nitpicky-warnings/index.rst | 7 + tests/roots/test-numbered-circular/conf.py | 1 + tests/roots/test-numbered-circular/index.rst | 5 + tests/roots/test-numbered-circular/sub.rst | 3 + tests/roots/test-numfig/bar.rst | 66 + tests/roots/test-numfig/baz.rst | 24 + tests/roots/test-numfig/conf.py | 1 + tests/roots/test-numfig/foo.rst | 81 + tests/roots/test-numfig/index.rst | 59 + tests/roots/test-numfig/rimg.png | Bin 0 -> 120 bytes .../roots/test-object-description-sections/conf.py | 0 .../test-object-description-sections/index.rst | 6 + tests/roots/test-productionlist/Bare.rst | 6 + tests/roots/test-productionlist/Dup1.rst | 5 + tests/roots/test-productionlist/Dup2.rst | 5 + .../roots/test-productionlist/LineContinuation.rst | 6 + tests/roots/test-productionlist/P1.rst | 6 + tests/roots/test-productionlist/P2.rst | 6 + tests/roots/test-productionlist/conf.py | 1 + tests/roots/test-productionlist/firstLineRule.rst | 5 + tests/roots/test-productionlist/index.rst | 27 + tests/roots/test-prolog/conf.py | 10 + tests/roots/test-prolog/index.rst | 7 + tests/roots/test-prolog/markdown.md | 3 + tests/roots/test-prolog/prolog_markdown_parser.py | 13 + tests/roots/test-prolog/restructuredtext.rst | 4 + tests/roots/test-pycode/cp_1251_coded.py | 4 + tests/roots/test-reST-code-block/conf.py | 0 tests/roots/test-reST-code-block/index.rst | 7 + tests/roots/test-reST-code-role/conf.py | 0 tests/roots/test-reST-code-role/index.rst | 9 + tests/roots/test-refonly_bullet_list/conf.py | 1 + tests/roots/test-refonly_bullet_list/index.rst | 14 + tests/roots/test-remote-logo/conf.py | 5 + tests/roots/test-remote-logo/index.rst | 31 + tests/roots/test-roles-download/another/dummy.dat | 1 + tests/roots/test-roles-download/conf.py | 3 + tests/roots/test-roles-download/dummy.dat | 0 tests/roots/test-roles-download/index.rst | 7 + tests/roots/test-root/Makefile | 67 + tests/roots/test-root/_templates/contentssb.html | 2 + tests/roots/test-root/_templates/customsb.html | 4 + tests/roots/test-root/_templates/layout.html | 15 + tests/roots/test-root/autodoc.txt | 39 + tests/roots/test-root/autodoc_target.py | 221 ++ tests/roots/test-root/bom.txt | 5 + tests/roots/test-root/conf.py | 148 ++ tests/roots/test-root/extapi.txt | 7 + tests/roots/test-root/extensions.txt | 28 + .../roots/test-root/file_with_special_#_chars.xyz | 0 tests/roots/test-root/footnote.txt | 60 + tests/roots/test-root/images.txt | 25 + tests/roots/test-root/img.foo.png | Bin 0 -> 66247 bytes tests/roots/test-root/img.gif | Bin 0 -> 24976 bytes tests/roots/test-root/img.pdf | Bin 0 -> 141783 bytes tests/roots/test-root/img.png | Bin 0 -> 66247 bytes tests/roots/test-root/includes.txt | 102 + tests/roots/test-root/index.txt | 65 + tests/roots/test-root/lists.txt | 70 + tests/roots/test-root/literal.inc | 13 + tests/roots/test-root/literal_orig.inc | 12 + tests/roots/test-root/markup.txt | 455 ++++ tests/roots/test-root/math.txt | 31 + tests/roots/test-root/objects.txt | 262 ++ tests/roots/test-root/otherext.foo | 2 + tests/roots/test-root/parsermod.py | 14 + tests/roots/test-root/quotes.inc | 1 + tests/roots/test-root/rimg.png | Bin 0 -> 120 bytes tests/roots/test-root/special/api.h | 2 + tests/roots/test-root/special/code.py | 2 + tests/roots/test-root/subdir/excluded.txt | 2 + tests/roots/test-root/subdir/images.txt | 6 + tests/roots/test-root/subdir/img.png | Bin 0 -> 66247 bytes tests/roots/test-root/subdir/include.inc | 5 + tests/roots/test-root/subdir/includes.txt | 18 + tests/roots/test-root/subdir/simg.png | Bin 0 -> 66247 bytes tests/roots/test-root/svgimg.pdf | Bin 0 -> 141783 bytes tests/roots/test-root/svgimg.svg | 4 + tests/roots/test-root/tabs.inc | 5 + tests/roots/test-root/test.inc | 3 + tests/roots/test-root/wrongenc.inc | 3 + tests/roots/test-search/conf.py | 2 + tests/roots/test-search/index.rst | 30 + tests/roots/test-search/nosearch.rst | 7 + tests/roots/test-search/tocitem.rst | 17 + tests/roots/test-smartquotes/conf.py | 0 tests/roots/test-smartquotes/index.rst | 8 + tests/roots/test-smartquotes/literals.rst | 12 + .../roots/test-stylesheets/_templates/layout.html | 8 + tests/roots/test-stylesheets/conf.py | 9 + tests/roots/test-stylesheets/index.rst | 4 + .../_templates/autosummary/class.rst | 9 + tests/roots/test-templating/_templates/layout.html | 6 + .../test-templating/autosummary_templating.txt | 7 + tests/roots/test-templating/conf.py | 9 + tests/roots/test-templating/index.txt | 7 + tests/roots/test-theming/child.zip | Bin 0 -> 661 bytes tests/roots/test-theming/conf.py | 3 + tests/roots/test-theming/index.rst | 5 + tests/roots/test-theming/parent.zip | Bin 0 -> 1039 bytes tests/roots/test-theming/test_theme/__init__.py | 5 + .../test_theme/staticfiles/layout.html | 5 + .../test_theme/staticfiles/static/staticimg.png | Bin 0 -> 120 bytes .../staticfiles/static/statictmpl.html_t | 2 + .../test-theming/test_theme/staticfiles/theme.conf | 7 + .../test-theming/test_theme/test-theme/theme.conf | 4 + tests/roots/test-theming/ziptheme.zip | Bin 0 -> 1039 bytes tests/roots/test-tocdepth/bar.rst | 27 + tests/roots/test-tocdepth/baz.rst | 5 + tests/roots/test-tocdepth/conf.py | 2 + tests/roots/test-tocdepth/foo.rst | 26 + tests/roots/test-tocdepth/index.rst | 8 + tests/roots/test-toctree-domain-objects/conf.py | 0 .../roots/test-toctree-domain-objects/domains.rst | 39 + tests/roots/test-toctree-domain-objects/index.rst | 6 + tests/roots/test-toctree-duplicated/conf.py | 0 tests/roots/test-toctree-duplicated/foo.rst | 2 + tests/roots/test-toctree-duplicated/index.rst | 7 + .../test-toctree-empty/_templates/localtoc.html | 2 + tests/roots/test-toctree-empty/conf.py | 2 + tests/roots/test-toctree-empty/index.rst | 4 + tests/roots/test-toctree-glob/bar/bar_1.rst | 4 + tests/roots/test-toctree-glob/bar/bar_2.rst | 4 + tests/roots/test-toctree-glob/bar/bar_3.rst | 4 + tests/roots/test-toctree-glob/bar/bar_4/index.rst | 4 + tests/roots/test-toctree-glob/bar/index.rst | 8 + tests/roots/test-toctree-glob/baz.rst | 4 + tests/roots/test-toctree-glob/conf.py | 1 + tests/roots/test-toctree-glob/foo.rst | 4 + tests/roots/test-toctree-glob/index.rst | 28 + tests/roots/test-toctree-glob/quux.rst | 4 + tests/roots/test-toctree-glob/qux/index.rst | 8 + tests/roots/test-toctree-glob/qux/qux_1.rst | 4 + tests/roots/test-toctree-glob/qux/qux_2.rst | 4 + tests/roots/test-toctree-index/conf.py | 0 tests/roots/test-toctree-index/foo.rst | 8 + tests/roots/test-toctree-index/index.rst | 15 + tests/roots/test-toctree-maxdepth/bar.rst | 27 + tests/roots/test-toctree-maxdepth/baz.rst | 5 + tests/roots/test-toctree-maxdepth/conf.py | 1 + tests/roots/test-toctree-maxdepth/foo.rst | 26 + tests/roots/test-toctree-maxdepth/index.rst | 9 + tests/roots/test-toctree-maxdepth/qux.rst | 9 + tests/roots/test-toctree/bar.rst | 2 + tests/roots/test-toctree/baz.rst | 2 + tests/roots/test-toctree/conf.py | 0 tests/roots/test-toctree/foo.rst | 15 + tests/roots/test-toctree/index.rst | 55 + tests/roots/test-toctree/quux.rst | 2 + tests/roots/test-toctree/qux.rst | 1 + tests/roots/test-toctree/tocdepth.rst | 15 + .../conf.py | 0 .../index.rst | 4 + .../conf.py | 1 + .../index.rst | 5 + tests/roots/test-trim_doctest_flags/conf.py | 1 + tests/roots/test-trim_doctest_flags/index.rst | 40 + tests/roots/test-versioning/added.txt | 20 + tests/roots/test-versioning/conf.py | 3 + tests/roots/test-versioning/deleted.txt | 12 + tests/roots/test-versioning/deleted_end.txt | 11 + tests/roots/test-versioning/index.txt | 13 + tests/roots/test-versioning/insert.txt | 18 + tests/roots/test-versioning/insert_beginning.txt | 18 + tests/roots/test-versioning/insert_similar.txt | 17 + tests/roots/test-versioning/modified.txt | 17 + tests/roots/test-versioning/original.txt | 15 + tests/roots/test-warnings/autodoc_fodder.py | 6 + tests/roots/test-warnings/conf.py | 6 + tests/roots/test-warnings/index.rst | 45 + tests/roots/test-warnings/svgimg.pdf | Bin 0 -> 141783 bytes tests/roots/test-warnings/svgimg.svg | 4 + tests/roots/test-warnings/undecodable.rst | 3 + tests/roots/test-warnings/wrongenc.inc | 3 + tests/test_addnodes.py | 51 + tests/test_api_translator.py | 92 + tests/test_application.py | 152 ++ tests/test_build.py | 135 + tests/test_build_changes.py | 34 + tests/test_build_dirhtml.py | 40 + tests/test_build_epub.py | 411 +++ tests/test_build_gettext.py | 235 ++ tests/test_build_html.py | 1841 ++++++++++++++ tests/test_build_latex.py | 1755 +++++++++++++ tests/test_build_linkcheck.py | 989 ++++++++ tests/test_build_manpage.py | 105 + tests/test_build_texinfo.py | 155 ++ tests/test_build_text.py | 278 ++ tests/test_builder.py | 39 + tests/test_catalogs.py | 74 + tests/test_config.py | 517 ++++ tests/test_correct_year.py | 29 + tests/test_directive_code.py | 595 +++++ tests/test_directive_object_description.py | 59 + tests/test_directive_only.py | 46 + tests/test_directive_other.py | 195 ++ tests/test_directive_patch.py | 110 + tests/test_directives_no_typesetting.py | 108 + tests/test_docutilsconf.py | 29 + tests/test_domain_c.py | 1076 ++++++++ tests/test_domain_cpp.py | 1744 +++++++++++++ tests/test_domain_js.py | 505 ++++ tests/test_domain_py.py | 2123 ++++++++++++++++ tests/test_domain_rst.py | 137 + tests/test_domain_std.py | 495 ++++ tests/test_environment.py | 145 ++ tests/test_environment_indexentries.py | 166 ++ tests/test_environment_record_dependencies.py | 10 + tests/test_environment_toctree.py | 396 +++ tests/test_errors.py | 11 + tests/test_events.py | 56 + tests/test_ext_apidoc.py | 665 +++++ tests/test_ext_autodoc.py | 2537 +++++++++++++++++++ tests/test_ext_autodoc_autoattribute.py | 176 ++ tests/test_ext_autodoc_autoclass.py | 517 ++++ tests/test_ext_autodoc_autodata.py | 106 + tests/test_ext_autodoc_autofunction.py | 201 ++ tests/test_ext_autodoc_automodule.py | 192 ++ tests/test_ext_autodoc_autoproperty.py | 91 + tests/test_ext_autodoc_configs.py | 1727 +++++++++++++ tests/test_ext_autodoc_events.py | 118 + tests/test_ext_autodoc_mock.py | 152 ++ tests/test_ext_autodoc_preserve_defaults.py | 192 ++ tests/test_ext_autodoc_private_members.py | 158 ++ tests/test_ext_autosectionlabel.py | 77 + tests/test_ext_autosummary.py | 686 +++++ tests/test_ext_coverage.py | 101 + tests/test_ext_doctest.py | 136 + tests/test_ext_duration.py | 14 + tests/test_ext_extlinks.py | 45 + tests/test_ext_githubpages.py | 26 + tests/test_ext_graphviz.py | 196 ++ tests/test_ext_ifconfig.py | 28 + tests/test_ext_imgconverter.py | 34 + tests/test_ext_imgmockconverter.py | 17 + tests/test_ext_inheritance_diagram.py | 342 +++ tests/test_ext_intersphinx.py | 568 +++++ tests/test_ext_math.py | 345 +++ tests/test_ext_napoleon.py | 218 ++ tests/test_ext_napoleon_docstring.py | 2660 ++++++++++++++++++++ tests/test_ext_todo.py | 109 + tests/test_ext_viewcode.py | 137 + tests/test_extension.py | 23 + tests/test_highlighting.py | 104 + tests/test_intl.py | 1527 +++++++++++ tests/test_locale.py | 76 + tests/test_markup.py | 619 +++++ tests/test_metadata.py | 43 + tests/test_parser.py | 57 + tests/test_project.py | 78 + tests/test_pycode.py | 173 ++ tests/test_pycode_ast.py | 62 + tests/test_pycode_parser.py | 511 ++++ tests/test_quickstart.py | 260 ++ tests/test_roles.py | 75 + tests/test_search.py | 306 +++ tests/test_smartquotes.py | 99 + tests/test_templating.py | 41 + tests/test_theming.py | 131 + tests/test_toctree.py | 39 + tests/test_transforms_move_module_targets.py | 77 + tests/test_transforms_post_transforms.py | 268 ++ tests/test_transforms_post_transforms_code.py | 44 + tests/test_transforms_reorder_nodes.py | 96 + tests/test_util.py | 73 + tests/test_util_display.py | 103 + tests/test_util_docstrings.py | 88 + tests/test_util_docutils.py | 92 + tests/test_util_fileutil.py | 103 + tests/test_util_i18n.py | 190 ++ tests/test_util_images.py | 74 + tests/test_util_inspect.py | 869 +++++++ tests/test_util_inventory.py | 116 + tests/test_util_logging.py | 398 +++ tests/test_util_matching.py | 174 ++ tests/test_util_nodes.py | 254 ++ tests/test_util_rst.py | 164 ++ tests/test_util_template.py | 29 + tests/test_util_typing.py | 536 ++++ tests/test_versioning.py | 120 + tests/test_writer_latex.py | 28 + tests/typing_test_data.py | 129 + tests/utils.py | 55 + 943 files changed, 50007 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/certs/cert.pem create mode 100644 tests/conftest.py create mode 100644 tests/ext_napoleon_pep526_data_google.py create mode 100644 tests/ext_napoleon_pep526_data_numpy.py create mode 100644 tests/js/documentation_options.js create mode 100644 tests/js/searchtools.js create mode 100644 tests/js/sphinx_highlight.js create mode 100644 tests/roots/test-add_enumerable_node/conf.py create mode 100644 tests/roots/test-add_enumerable_node/enumerable_node.py create mode 100644 tests/roots/test-add_enumerable_node/index.rst create mode 100644 tests/roots/test-add_enumerable_node/rimg.png create mode 100644 tests/roots/test-add_source_parser-conflicts-with-users-setting/conf.py create mode 100644 tests/roots/test-add_source_parser-conflicts-with-users-setting/source_parser.py create mode 100644 tests/roots/test-add_source_parser/conf.py create mode 100644 tests/roots/test-add_source_parser/source_parser.py create mode 100644 tests/roots/test-api-set-translator/conf.py create mode 100644 tests/roots/test-api-set-translator/index.rst create mode 100644 tests/roots/test-api-set-translator/nonext/conf.py create mode 100644 tests/roots/test-api-set-translator/translator.py create mode 100644 tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so create mode 100644 tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx create mode 100644 tests/roots/test-apidoc-pep420/a/b/c/__init__.py create mode 100644 tests/roots/test-apidoc-pep420/a/b/c/d.py create mode 100644 tests/roots/test-apidoc-pep420/a/b/e/__init__.py create mode 100644 tests/roots/test-apidoc-pep420/a/b/e/f.py create mode 100644 tests/roots/test-apidoc-pep420/a/b/x/y.py create mode 100644 tests/roots/test-apidoc-subpackage-in-toc/parent/__init__.py create mode 100644 tests/roots/test-apidoc-subpackage-in-toc/parent/child/__init__.py create mode 100644 tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py create mode 100644 tests/roots/test-apidoc-toc/mypackage/__init__.py create mode 100755 tests/roots/test-apidoc-toc/mypackage/main.py create mode 100644 tests/roots/test-apidoc-toc/mypackage/no_init/foo.py create mode 100644 tests/roots/test-apidoc-toc/mypackage/resource/__init__.py create mode 100644 tests/roots/test-apidoc-toc/mypackage/resource/resource.txt create mode 100644 tests/roots/test-apidoc-toc/mypackage/something/__init__.py create mode 100644 tests/roots/test-apidoc-trailing-underscore/package_/__init__.py create mode 100644 tests/roots/test-apidoc-trailing-underscore/package_/module_.py create mode 100644 tests/roots/test-autosummary/conf.py create mode 100644 tests/roots/test-autosummary/dummy_module.py create mode 100644 tests/roots/test-autosummary/index.rst create mode 100644 tests/roots/test-autosummary/sphinx.rst create mode 100644 tests/roots/test-autosummary/underscore_module_.py create mode 100644 tests/roots/test-basic/conf.py create mode 100644 tests/roots/test-basic/index.rst create mode 100644 tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/extra.css create mode 100644 tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/mytheme.css create mode 100644 tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/theme.conf create mode 100644 tests/roots/test-build-html-theme-having-multiple-stylesheets/conf.py create mode 100644 tests/roots/test-build-html-theme-having-multiple-stylesheets/index.rst create mode 100644 tests/roots/test-build-html-translator/conf.py create mode 100644 tests/roots/test-build-html-translator/index.rst create mode 100644 tests/roots/test-build-text/conf.py create mode 100644 tests/roots/test-build-text/doc1.txt create mode 100644 tests/roots/test-build-text/doc2.txt create mode 100644 tests/roots/test-build-text/index.txt create mode 100644 tests/roots/test-build-text/lineblock.txt create mode 100644 tests/roots/test-build-text/listitems.txt create mode 100644 tests/roots/test-build-text/maxwidth.txt create mode 100644 tests/roots/test-build-text/nonascii_maxwidth.txt create mode 100644 tests/roots/test-build-text/nonascii_table.txt create mode 100644 tests/roots/test-build-text/nonascii_title.txt create mode 100644 tests/roots/test-build-text/table.txt create mode 100644 tests/roots/test-build-text/table_colspan.txt create mode 100644 tests/roots/test-build-text/table_colspan_and_rowspan.txt create mode 100644 tests/roots/test-build-text/table_colspan_left.txt create mode 100644 tests/roots/test-build-text/table_rowspan.txt create mode 100644 tests/roots/test-builder-dirhtml/bar.rst create mode 100644 tests/roots/test-builder-dirhtml/conf.py create mode 100644 tests/roots/test-builder-dirhtml/foo/foo_1.rst create mode 100644 tests/roots/test-builder-dirhtml/foo/foo_2.rst create mode 100644 tests/roots/test-builder-dirhtml/foo/index.rst create mode 100644 tests/roots/test-builder-dirhtml/index.rst create mode 100644 tests/roots/test-builder-gettext-dont-rebuild-mo/bom.rst create mode 100644 tests/roots/test-builder-gettext-dont-rebuild-mo/conf.py create mode 100644 tests/roots/test-builder-gettext-dont-rebuild-mo/index.rst create mode 100644 tests/roots/test-builder-gettext-dont-rebuild-mo/xx/LC_MESSAGES/bom.po create mode 100644 tests/roots/test-changes/base.rst create mode 100644 tests/roots/test-changes/c-api.rst create mode 100644 tests/roots/test-changes/conf.py create mode 100644 tests/roots/test-changes/contents.rst create mode 100644 tests/roots/test-changes/library/utils.rst create mode 100644 tests/roots/test-circular/conf.py create mode 100644 tests/roots/test-circular/index.rst create mode 100644 tests/roots/test-circular/sub.rst create mode 100644 tests/roots/test-config/conf.py create mode 100644 tests/roots/test-copyright-multiline/conf.py create mode 100644 tests/roots/test-copyright-multiline/index.rst create mode 100644 tests/roots/test-correct-year/conf.py create mode 100644 tests/roots/test-correct-year/index.rst create mode 100644 tests/roots/test-default_role/conf.py create mode 100644 tests/roots/test-default_role/foo.rst create mode 100644 tests/roots/test-default_role/index.rst create mode 100644 tests/roots/test-directive-code/caption.rst create mode 100644 tests/roots/test-directive-code/classes.rst create mode 100644 tests/roots/test-directive-code/conf.py create mode 100644 tests/roots/test-directive-code/dedent.rst create mode 100644 tests/roots/test-directive-code/emphasize.rst create mode 100644 tests/roots/test-directive-code/empty.inc create mode 100644 tests/roots/test-directive-code/error.inc create mode 100644 tests/roots/test-directive-code/force.rst create mode 100644 tests/roots/test-directive-code/highlight.rst create mode 100644 tests/roots/test-directive-code/index.rst create mode 100644 tests/roots/test-directive-code/linenos.rst create mode 100644 tests/roots/test-directive-code/linenothreshold.rst create mode 100644 tests/roots/test-directive-code/literal-diff.inc create mode 100644 tests/roots/test-directive-code/literal-short.inc create mode 100644 tests/roots/test-directive-code/literal.inc create mode 100644 tests/roots/test-directive-code/namedblocks.rst create mode 100644 tests/roots/test-directive-code/py-decorators.inc create mode 100644 tests/roots/test-directive-code/py-decorators.rst create mode 100644 tests/roots/test-directive-code/python.rst create mode 100644 tests/roots/test-directive-code/target.py create mode 100644 tests/roots/test-directive-csv-table/conf.py create mode 100644 tests/roots/test-directive-csv-table/example.csv create mode 100644 tests/roots/test-directive-csv-table/subdir/example.csv create mode 100644 tests/roots/test-directive-include/bar.txt create mode 100644 tests/roots/test-directive-include/baz/baz.rst create mode 100644 tests/roots/test-directive-include/conf.py create mode 100644 tests/roots/test-directive-include/foo.rst create mode 100644 tests/roots/test-directive-include/text.txt create mode 100644 tests/roots/test-directive-only/conf.py create mode 100644 tests/roots/test-directive-only/index.rst create mode 100644 tests/roots/test-directive-only/only.rst create mode 100644 tests/roots/test-directives-raw/conf.py create mode 100644 tests/roots/test-directives-raw/index.rst create mode 100644 tests/roots/test-docutilsconf/conf.py create mode 100644 tests/roots/test-docutilsconf/docutils.conf create mode 100644 tests/roots/test-docutilsconf/index.rst create mode 100644 tests/roots/test-domain-c-c_maximum_signature_line_length/conf.py create mode 100644 tests/roots/test-domain-c-c_maximum_signature_line_length/index.rst create mode 100644 tests/roots/test-domain-c-intersphinx/conf.py create mode 100644 tests/roots/test-domain-c-intersphinx/index.rst create mode 100644 tests/roots/test-domain-c/anon-dup-decl.rst create mode 100644 tests/roots/test-domain-c/conf.py create mode 100644 tests/roots/test-domain-c/field-role.rst create mode 100644 tests/roots/test-domain-c/function_param_target.rst create mode 100644 tests/roots/test-domain-c/index.rst create mode 100644 tests/roots/test-domain-c/namespace.rst create mode 100644 tests/roots/test-domain-c/ns_lookup.rst create mode 100644 tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/conf.py create mode 100644 tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/index.rst create mode 100644 tests/roots/test-domain-cpp-intersphinx/conf.py create mode 100644 tests/roots/test-domain-cpp-intersphinx/index.rst create mode 100644 tests/roots/test-domain-cpp/anon-dup-decl.rst create mode 100644 tests/roots/test-domain-cpp/any-role.rst create mode 100644 tests/roots/test-domain-cpp/backslash.rst create mode 100644 tests/roots/test-domain-cpp/conf.py create mode 100644 tests/roots/test-domain-cpp/field-role.rst create mode 100644 tests/roots/test-domain-cpp/index.rst create mode 100644 tests/roots/test-domain-cpp/lookup-key-overload.rst create mode 100644 tests/roots/test-domain-cpp/multi-decl-lookup.rst create mode 100644 tests/roots/test-domain-cpp/roles-targets-ok.rst create mode 100644 tests/roots/test-domain-cpp/roles-targets-warn.rst create mode 100644 tests/roots/test-domain-cpp/roles.rst create mode 100644 tests/roots/test-domain-cpp/roles2.rst create mode 100644 tests/roots/test-domain-cpp/semicolon.rst create mode 100644 tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst create mode 100644 tests/roots/test-domain-cpp/xref_consistency.rst create mode 100644 tests/roots/test-domain-js-javascript_maximum_signature_line_length/conf.py create mode 100644 tests/roots/test-domain-js-javascript_maximum_signature_line_length/index.rst create mode 100644 tests/roots/test-domain-js/conf.py create mode 100644 tests/roots/test-domain-js/index.rst create mode 100644 tests/roots/test-domain-js/module.rst create mode 100644 tests/roots/test-domain-js/roles.rst create mode 100644 tests/roots/test-domain-py-python_maximum_signature_line_length/conf.py create mode 100644 tests/roots/test-domain-py-python_maximum_signature_line_length/index.rst create mode 100644 tests/roots/test-domain-py-python_use_unqualified_type_names/conf.py create mode 100644 tests/roots/test-domain-py-python_use_unqualified_type_names/index.rst create mode 100644 tests/roots/test-domain-py-xref-warning/conf.py create mode 100644 tests/roots/test-domain-py-xref-warning/index.rst create mode 100644 tests/roots/test-domain-py/abbr.rst create mode 100644 tests/roots/test-domain-py/canonical.rst create mode 100644 tests/roots/test-domain-py/conf.py create mode 100644 tests/roots/test-domain-py/index.rst create mode 100644 tests/roots/test-domain-py/module.rst create mode 100644 tests/roots/test-domain-py/module_option.rst create mode 100644 tests/roots/test-domain-py/roles.rst create mode 100644 tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme1/theme.conf create mode 100644 tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme2/theme.conf create mode 100644 tests/roots/test-double-inheriting-theme/conf.py create mode 100644 tests/roots/test-double-inheriting-theme/index.rst create mode 100644 tests/roots/test-environment-record-dependencies/api.rst create mode 100644 tests/roots/test-environment-record-dependencies/conf.py create mode 100644 tests/roots/test-environment-record-dependencies/example_module.py create mode 100644 tests/roots/test-environment-record-dependencies/index.rst create mode 100644 tests/roots/test-epub-anchor-id/conf.py create mode 100644 tests/roots/test-epub-anchor-id/index.rst create mode 100644 tests/roots/test-ext-autodoc/autodoc_dummy_bar.py create mode 100644 tests/roots/test-ext-autodoc/autodoc_dummy_module.py create mode 100644 tests/roots/test-ext-autodoc/bug2437/__init__.py create mode 100644 tests/roots/test-ext-autodoc/bug2437/autodoc_dummy_foo.py create mode 100644 tests/roots/test-ext-autodoc/circular_import/__init__.py create mode 100644 tests/roots/test-ext-autodoc/circular_import/a.py create mode 100644 tests/roots/test-ext-autodoc/circular_import/b.py create mode 100644 tests/roots/test-ext-autodoc/circular_import/c.py create mode 100644 tests/roots/test-ext-autodoc/conf.py create mode 100644 tests/roots/test-ext-autodoc/index.rst create mode 100644 tests/roots/test-ext-autodoc/target/TYPE_CHECKING.py create mode 100644 tests/roots/test-ext-autodoc/target/__init__.py create mode 100644 tests/roots/test-ext-autodoc/target/_functions_to_import.py create mode 100644 tests/roots/test-ext-autodoc/target/abstractmethods.py create mode 100644 tests/roots/test-ext-autodoc/target/annotated.py create mode 100644 tests/roots/test-ext-autodoc/target/autoclass_content.py create mode 100644 tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py create mode 100644 tests/roots/test-ext-autodoc/target/bound_method.py create mode 100644 tests/roots/test-ext-autodoc/target/cached_property.py create mode 100644 tests/roots/test-ext-autodoc/target/callable.py create mode 100644 tests/roots/test-ext-autodoc/target/canonical/__init__.py create mode 100644 tests/roots/test-ext-autodoc/target/canonical/original.py create mode 100644 tests/roots/test-ext-autodoc/target/classes.py create mode 100644 tests/roots/test-ext-autodoc/target/coroutine.py create mode 100644 tests/roots/test-ext-autodoc/target/cython.pyx create mode 100644 tests/roots/test-ext-autodoc/target/decorator.py create mode 100644 tests/roots/test-ext-autodoc/target/descriptor.py create mode 100644 tests/roots/test-ext-autodoc/target/docstring_signature.py create mode 100644 tests/roots/test-ext-autodoc/target/empty_all.py create mode 100644 tests/roots/test-ext-autodoc/target/enums.py create mode 100644 tests/roots/test-ext-autodoc/target/final.py create mode 100644 tests/roots/test-ext-autodoc/target/functions.py create mode 100644 tests/roots/test-ext-autodoc/target/generic_class.py create mode 100644 tests/roots/test-ext-autodoc/target/genericalias.py create mode 100644 tests/roots/test-ext-autodoc/target/hide_value.py create mode 100644 tests/roots/test-ext-autodoc/target/imported_members.py create mode 100644 tests/roots/test-ext-autodoc/target/inheritance.py create mode 100644 tests/roots/test-ext-autodoc/target/instance_variable.py create mode 100644 tests/roots/test-ext-autodoc/target/literal.py create mode 100644 tests/roots/test-ext-autodoc/target/metadata.py create mode 100644 tests/roots/test-ext-autodoc/target/methods.py create mode 100644 tests/roots/test-ext-autodoc/target/module.py create mode 100644 tests/roots/test-ext-autodoc/target/name_conflict/__init__.py create mode 100644 tests/roots/test-ext-autodoc/target/name_conflict/foo.py create mode 100644 tests/roots/test-ext-autodoc/target/name_mangling.py create mode 100644 tests/roots/test-ext-autodoc/target/need_mocks.py create mode 100644 tests/roots/test-ext-autodoc/target/overload.py create mode 100644 tests/roots/test-ext-autodoc/target/overload2.py create mode 100644 tests/roots/test-ext-autodoc/target/partialfunction.py create mode 100644 tests/roots/test-ext-autodoc/target/partialmethod.py create mode 100644 tests/roots/test-ext-autodoc/target/pep570.py create mode 100644 tests/roots/test-ext-autodoc/target/pep604.py create mode 100644 tests/roots/test-ext-autodoc/target/preserve_defaults.py create mode 100644 tests/roots/test-ext-autodoc/target/preserve_defaults_special_constructs.py create mode 100644 tests/roots/test-ext-autodoc/target/private.py create mode 100644 tests/roots/test-ext-autodoc/target/process_docstring.py create mode 100644 tests/roots/test-ext-autodoc/target/properties.py create mode 100644 tests/roots/test-ext-autodoc/target/singledispatch.py create mode 100644 tests/roots/test-ext-autodoc/target/singledispatchmethod.py create mode 100644 tests/roots/test-ext-autodoc/target/slots.py create mode 100644 tests/roots/test-ext-autodoc/target/sort_by_all.py create mode 100644 tests/roots/test-ext-autodoc/target/typed_vars.py create mode 100644 tests/roots/test-ext-autodoc/target/typehints.py create mode 100644 tests/roots/test-ext-autodoc/target/typevar.py create mode 100644 tests/roots/test-ext-autodoc/target/uninitialized_attributes.py create mode 100644 tests/roots/test-ext-autodoc/target/wrappedfunction.py create mode 100644 tests/roots/test-ext-autosectionlabel-prefix-document/conf.py create mode 100644 tests/roots/test-ext-autosectionlabel-prefix-document/index.rst create mode 100644 tests/roots/test-ext-autosectionlabel/conf.py create mode 100644 tests/roots/test-ext-autosectionlabel/index.rst create mode 100644 tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py create mode 100644 tests/roots/test-ext-autosummary-filename-map/conf.py create mode 100644 tests/roots/test-ext-autosummary-filename-map/index.rst create mode 100644 tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/__init__.py create mode 100644 tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/autosummary_dummy_module.py create mode 100644 tests/roots/test-ext-autosummary-imported_members/conf.py create mode 100644 tests/roots/test-ext-autosummary-imported_members/index.rst create mode 100644 tests/roots/test-ext-autosummary-mock_imports/conf.py create mode 100644 tests/roots/test-ext-autosummary-mock_imports/foo.py create mode 100644 tests/roots/test-ext-autosummary-mock_imports/index.rst create mode 100644 tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/__init__.py create mode 100644 tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/autosummary_dummy_module.py create mode 100644 tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/extra_dummy_module.py create mode 100644 tests/roots/test-ext-autosummary-module_all/conf.py create mode 100644 tests/roots/test-ext-autosummary-module_all/index.rst create mode 100644 tests/roots/test-ext-autosummary-recursive/conf.py create mode 100644 tests/roots/test-ext-autosummary-recursive/index.rst create mode 100644 tests/roots/test-ext-autosummary-recursive/package/__init__.py create mode 100644 tests/roots/test-ext-autosummary-recursive/package/module.py create mode 100644 tests/roots/test-ext-autosummary-recursive/package/module_importfail.py create mode 100644 tests/roots/test-ext-autosummary-recursive/package/package/__init__.py create mode 100644 tests/roots/test-ext-autosummary-recursive/package/package/module.py create mode 100644 tests/roots/test-ext-autosummary-recursive/package2/__init__.py create mode 100644 tests/roots/test-ext-autosummary-recursive/package2/module.py create mode 100644 tests/roots/test-ext-autosummary-skip-member/conf.py create mode 100644 tests/roots/test-ext-autosummary-skip-member/index.rst create mode 100644 tests/roots/test-ext-autosummary-skip-member/target.py create mode 100644 tests/roots/test-ext-autosummary-template/_templates/empty.rst create mode 100644 tests/roots/test-ext-autosummary-template/conf.py create mode 100644 tests/roots/test-ext-autosummary-template/index.rst create mode 100644 tests/roots/test-ext-autosummary-template/target.py create mode 100644 tests/roots/test-ext-autosummary/autosummary_class_module.py create mode 100644 tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py create mode 100644 tests/roots/test-ext-autosummary/autosummary_dummy_module.py create mode 100644 tests/roots/test-ext-autosummary/autosummary_importfail.py create mode 100644 tests/roots/test-ext-autosummary/conf.py create mode 100644 tests/roots/test-ext-autosummary/index.rst create mode 100644 tests/roots/test-ext-coverage/conf.py create mode 100644 tests/roots/test-ext-coverage/coverage_ignored.py create mode 100644 tests/roots/test-ext-coverage/coverage_not_ignored.py create mode 100644 tests/roots/test-ext-coverage/index.rst create mode 100644 tests/roots/test-ext-doctest-skipif/conf.py create mode 100644 tests/roots/test-ext-doctest-skipif/skipif.txt create mode 100644 tests/roots/test-ext-doctest-with-autodoc/conf.py create mode 100644 tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py create mode 100644 tests/roots/test-ext-doctest-with-autodoc/dir/bar.py create mode 100644 tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst create mode 100644 tests/roots/test-ext-doctest-with-autodoc/foo.py create mode 100644 tests/roots/test-ext-doctest-with-autodoc/index.rst create mode 100644 tests/roots/test-ext-doctest/conf.py create mode 100644 tests/roots/test-ext-doctest/doctest.txt create mode 100644 tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py create mode 100644 tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/index.rst create mode 100644 tests/roots/test-ext-extlinks-hardcoded-urls/conf.py create mode 100644 tests/roots/test-ext-extlinks-hardcoded-urls/index.rst create mode 100644 tests/roots/test-ext-githubpages/conf.py create mode 100644 tests/roots/test-ext-githubpages/index.rst create mode 100644 tests/roots/test-ext-graphviz/_static/images/test.svg create mode 100644 tests/roots/test-ext-graphviz/conf.py create mode 100644 tests/roots/test-ext-graphviz/graph.dot create mode 100644 tests/roots/test-ext-graphviz/graph.xx.dot create mode 100644 tests/roots/test-ext-graphviz/index.rst create mode 100644 tests/roots/test-ext-ifconfig/conf.py create mode 100644 tests/roots/test-ext-ifconfig/index.rst create mode 100644 tests/roots/test-ext-imgconverter/conf.py create mode 100644 tests/roots/test-ext-imgconverter/img.pdf create mode 100644 tests/roots/test-ext-imgconverter/index.rst create mode 100644 tests/roots/test-ext-imgconverter/svgimg.svg create mode 100644 tests/roots/test-ext-imgmockconverter/1/svgimg.svg create mode 100644 tests/roots/test-ext-imgmockconverter/2/svgimg.svg create mode 100644 tests/roots/test-ext-imgmockconverter/conf.py create mode 100644 tests/roots/test-ext-imgmockconverter/index.rst create mode 100644 tests/roots/test-ext-imgmockconverter/mocksvgconverter.py create mode 100644 tests/roots/test-ext-inheritance_diagram/conf.py create mode 100644 tests/roots/test-ext-inheritance_diagram/example/__init__.py create mode 100644 tests/roots/test-ext-inheritance_diagram/example/sphinx.py create mode 100644 tests/roots/test-ext-inheritance_diagram/external/other.py create mode 100644 tests/roots/test-ext-inheritance_diagram/index.rst create mode 100644 tests/roots/test-ext-inheritance_diagram/subdir/page1.rst create mode 100644 tests/roots/test-ext-inheritance_diagram/subdir/page2.rst create mode 100644 tests/roots/test-ext-inheritance_diagram/test.py create mode 100644 tests/roots/test-ext-intersphinx-cppdomain/conf.py create mode 100644 tests/roots/test-ext-intersphinx-cppdomain/index.rst create mode 100644 tests/roots/test-ext-intersphinx-role/conf.py create mode 100644 tests/roots/test-ext-intersphinx-role/index.rst create mode 100644 tests/roots/test-ext-math-compat/conf.py create mode 100644 tests/roots/test-ext-math-compat/index.rst create mode 100644 tests/roots/test-ext-math-simple/conf.py create mode 100644 tests/roots/test-ext-math-simple/index.rst create mode 100644 tests/roots/test-ext-math/conf.py create mode 100644 tests/roots/test-ext-math/index.rst create mode 100644 tests/roots/test-ext-math/math.rst create mode 100644 tests/roots/test-ext-math/nomath.rst create mode 100644 tests/roots/test-ext-math/page.rst create mode 100644 tests/roots/test-ext-napoleon/conf.py create mode 100644 tests/roots/test-ext-napoleon/index.rst create mode 100644 tests/roots/test-ext-napoleon/mypackage/__init__.py create mode 100644 tests/roots/test-ext-napoleon/mypackage/typehints.py create mode 100644 tests/roots/test-ext-napoleon/typehints.rst create mode 100644 tests/roots/test-ext-todo/bar.rst create mode 100644 tests/roots/test-ext-todo/conf.py create mode 100644 tests/roots/test-ext-todo/foo.rst create mode 100644 tests/roots/test-ext-todo/index.rst create mode 100644 tests/roots/test-ext-viewcode-find/conf.py create mode 100644 tests/roots/test-ext-viewcode-find/index.rst create mode 100644 tests/roots/test-ext-viewcode-find/not_a_package/__init__.py create mode 100644 tests/roots/test-ext-viewcode-find/not_a_package/submodule.py create mode 100644 tests/roots/test-ext-viewcode/conf.py create mode 100644 tests/roots/test-ext-viewcode/index.rst create mode 100644 tests/roots/test-ext-viewcode/objects.rst create mode 100644 tests/roots/test-ext-viewcode/spam/__init__.py create mode 100644 tests/roots/test-ext-viewcode/spam/mod1.py create mode 100644 tests/roots/test-ext-viewcode/spam/mod2.py create mode 100644 tests/roots/test-ext-viewcode/spam/mod3.py create mode 100644 tests/roots/test-extensions/conf.py create mode 100644 tests/roots/test-extensions/read_parallel.py create mode 100644 tests/roots/test-extensions/read_serial.py create mode 100644 tests/roots/test-extensions/write_parallel.py create mode 100644 tests/roots/test-extensions/write_serial.py create mode 100644 tests/roots/test-footnotes/bar.rst create mode 100644 tests/roots/test-footnotes/baz.rst create mode 100644 tests/roots/test-footnotes/conf.py create mode 100644 tests/roots/test-footnotes/index.rst create mode 100644 tests/roots/test-footnotes/rimg.png create mode 100644 tests/roots/test-gettext-template/_templates/template1.html create mode 100644 tests/roots/test-gettext-template/_templates/template2.html create mode 100644 tests/roots/test-gettext-template/conf.py create mode 100644 tests/roots/test-gettext-template/index.rst create mode 100644 tests/roots/test-glossary/conf.py create mode 100644 tests/roots/test-glossary/index.rst create mode 100644 tests/roots/test-highlight_options/conf.py create mode 100644 tests/roots/test-highlight_options/index.rst create mode 100644 tests/roots/test-html_assets/conf.py create mode 100644 tests/roots/test-html_assets/extra/.htaccess create mode 100644 tests/roots/test-html_assets/extra/.htpasswd create mode 100644 tests/roots/test-html_assets/extra/API.html_t create mode 100644 tests/roots/test-html_assets/extra/css/style.css create mode 100644 tests/roots/test-html_assets/extra/index.rst create mode 100644 tests/roots/test-html_assets/extra/rimg.png create mode 100644 tests/roots/test-html_assets/extra/subdir/.htaccess create mode 100644 tests/roots/test-html_assets/extra/subdir/.htpasswd create mode 100644 tests/roots/test-html_assets/index.rst create mode 100644 tests/roots/test-html_assets/static/.htaccess create mode 100644 tests/roots/test-html_assets/static/.htpasswd create mode 100644 tests/roots/test-html_assets/static/API.html_t create mode 100644 tests/roots/test-html_assets/static/css/style.css create mode 100644 tests/roots/test-html_assets/static/index.rst create mode 100644 tests/roots/test-html_assets/static/js/custom.js create mode 100644 tests/roots/test-html_assets/static/rimg.png create mode 100644 tests/roots/test-html_assets/static/subdir/.htaccess create mode 100644 tests/roots/test-html_assets/static/subdir/.htpasswd create mode 100644 tests/roots/test-html_assets/subdir/_build/index.html create mode 100644 tests/roots/test-html_assets/subdir/background.png create mode 100644 tests/roots/test-html_entity/conf.py create mode 100644 tests/roots/test-html_entity/index.rst create mode 100644 tests/roots/test-html_file_checksum/conf.py create mode 100644 tests/roots/test-html_file_checksum/index.rst create mode 100644 tests/roots/test-html_file_checksum/static/empty.js create mode 100644 tests/roots/test-html_file_checksum/static/script.js create mode 100644 tests/roots/test-html_file_checksum/static/stylesheet-a.css create mode 100644 tests/roots/test-html_file_checksum/static/stylesheet-b.css create mode 100644 tests/roots/test-html_scaled_image_link/conf.py create mode 100644 tests/roots/test-html_scaled_image_link/img.png create mode 100644 tests/roots/test-html_scaled_image_link/index.rst create mode 100644 tests/roots/test-html_signaturereturn_icon/conf.py create mode 100644 tests/roots/test-html_signaturereturn_icon/index.rst create mode 100644 tests/roots/test-html_style/_static/default.css create mode 100644 tests/roots/test-html_style/conf.py create mode 100644 tests/roots/test-html_style/index.rst create mode 100644 tests/roots/test-image-escape/conf.py create mode 100644 tests/roots/test-image-escape/img_#1.png create mode 100644 tests/roots/test-image-escape/index.rst create mode 100644 tests/roots/test-image-in-parsed-literal/conf.py create mode 100644 tests/roots/test-image-in-parsed-literal/index.rst create mode 100644 tests/roots/test-image-in-parsed-literal/pic.png create mode 100644 tests/roots/test-image-in-section/conf.py create mode 100644 tests/roots/test-image-in-section/index.rst create mode 100644 tests/roots/test-image-in-section/pic.png create mode 100644 tests/roots/test-images/conf.py create mode 100644 tests/roots/test-images/img.gif create mode 100644 tests/roots/test-images/img.ja.png create mode 100644 tests/roots/test-images/img.pdf create mode 100644 tests/roots/test-images/img.png create mode 100644 tests/roots/test-images/img.zh.png create mode 100644 tests/roots/test-images/index.rst create mode 100644 tests/roots/test-images/rimg.png create mode 100644 tests/roots/test-images/rimg.png.xx create mode 100644 tests/roots/test-images/rimg.xx.png create mode 100644 tests/roots/test-images/subdir/index.rst create mode 100644 tests/roots/test-images/subdir/rimg.png create mode 100644 tests/roots/test-images/subdir/rimg.xx.png create mode 100644 tests/roots/test-images/subdir/svgimg.pdf create mode 100644 tests/roots/test-images/subdir/svgimg.svg create mode 100644 tests/roots/test-images/subdir/svgimg.xx.svg create mode 100644 "tests/roots/test-images/testim\303\244ge.png" create mode 100644 tests/roots/test-index_on_title/conf.py create mode 100644 tests/roots/test-index_on_title/contents.rst create mode 100644 tests/roots/test-inheritance/basic_diagram.rst create mode 100644 tests/roots/test-inheritance/conf.py create mode 100644 tests/roots/test-inheritance/diagram_module_w_2_top_classes.rst create mode 100644 tests/roots/test-inheritance/diagram_w_1_top_class.rst create mode 100644 tests/roots/test-inheritance/diagram_w_2_top_classes.rst create mode 100644 tests/roots/test-inheritance/diagram_w_nested_classes.rst create mode 100644 tests/roots/test-inheritance/diagram_w_parts.rst create mode 100644 tests/roots/test-inheritance/dummy/__init__.py create mode 100644 tests/roots/test-inheritance/dummy/test.py create mode 100644 tests/roots/test-inheritance/dummy/test_nested.py create mode 100644 tests/roots/test-inheritance/index.rst create mode 100644 tests/roots/test-intl/_templates/contents.html create mode 100644 tests/roots/test-intl/admonitions.txt create mode 100644 tests/roots/test-intl/bom.txt create mode 100644 tests/roots/test-intl/conf.py create mode 100644 tests/roots/test-intl/definition_terms.txt create mode 100644 tests/roots/test-intl/docfields.txt create mode 100644 tests/roots/test-intl/external_links.txt create mode 100644 tests/roots/test-intl/figure.txt create mode 100644 tests/roots/test-intl/footnote.txt create mode 100644 tests/roots/test-intl/glossary_terms.txt create mode 100644 tests/roots/test-intl/glossary_terms_inconsistency.txt create mode 100644 tests/roots/test-intl/i18n.png create mode 100644 tests/roots/test-intl/img.png create mode 100644 tests/roots/test-intl/index.txt create mode 100644 tests/roots/test-intl/index_entries.txt create mode 100644 tests/roots/test-intl/label_target.txt create mode 100644 tests/roots/test-intl/literalblock.txt create mode 100644 tests/roots/test-intl/noqa.txt create mode 100644 tests/roots/test-intl/only.txt create mode 100644 tests/roots/test-intl/raw.txt create mode 100644 tests/roots/test-intl/refs.txt create mode 100644 tests/roots/test-intl/refs_inconsistency.txt create mode 100644 tests/roots/test-intl/refs_python_domain.txt create mode 100644 tests/roots/test-intl/role_xref.txt create mode 100644 tests/roots/test-intl/rubric.txt create mode 100644 tests/roots/test-intl/section.txt create mode 100644 tests/roots/test-intl/seealso.txt create mode 100644 tests/roots/test-intl/subdir/index.txt create mode 100644 tests/roots/test-intl/table.txt create mode 100644 tests/roots/test-intl/toctree.txt create mode 100644 tests/roots/test-intl/topic.txt create mode 100644 tests/roots/test-intl/translation_progress.txt create mode 100644 tests/roots/test-intl/versionchange.txt create mode 100644 tests/roots/test-intl/warnings.txt create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/admonitions.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/bom.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/definition_terms.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/docfields.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/external_links.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/figure.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/footnote.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms_inconsistency.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/index.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/index_entries.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/label_target.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/noqa.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/only.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/raw.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/refs.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/refs_inconsistency.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/refs_python_domain.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/role_xref.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/rubric.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/section.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/seealso.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/sphinx.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/table.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/toctree.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/topic.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/translation_progress.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/versionchange.po create mode 100644 tests/roots/test-intl/xx/LC_MESSAGES/warnings.po create mode 100644 tests/roots/test-intl_substitution_definitions/conf.py create mode 100644 tests/roots/test-intl_substitution_definitions/i18n.png create mode 100644 tests/roots/test-intl_substitution_definitions/img.png create mode 100644 tests/roots/test-intl_substitution_definitions/index.rst create mode 100644 tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution.rst create mode 100644 tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution_excluded.rst create mode 100644 tests/roots/test-intl_substitution_definitions/xx/LC_MESSAGES/prolog_epilog_substitution.po create mode 100644 tests/roots/test-keep_warnings/conf.py create mode 100644 tests/roots/test-keep_warnings/index.rst create mode 100644 tests/roots/test-latex-babel/bar.rst create mode 100644 tests/roots/test-latex-babel/conf.py create mode 100644 tests/roots/test-latex-babel/foo.rst create mode 100644 tests/roots/test-latex-babel/index.rst create mode 100644 tests/roots/test-latex-container/conf.py create mode 100644 tests/roots/test-latex-container/index.rst create mode 100644 tests/roots/test-latex-equations/conf.py create mode 100644 tests/roots/test-latex-equations/equations.rst create mode 100644 tests/roots/test-latex-equations/expects/latex-equations.tex create mode 100644 tests/roots/test-latex-figure-in-admonition/conf.py create mode 100644 tests/roots/test-latex-figure-in-admonition/img.png create mode 100644 tests/roots/test-latex-figure-in-admonition/index.rst create mode 100644 tests/roots/test-latex-includegraphics/conf.py create mode 100644 tests/roots/test-latex-includegraphics/img.png create mode 100644 tests/roots/test-latex-includegraphics/index.rst create mode 100644 tests/roots/test-latex-includegraphics/sphinx.png create mode 100644 tests/roots/test-latex-includegraphics/tall.png create mode 100644 tests/roots/test-latex-index/conf.py create mode 100644 tests/roots/test-latex-index/index.rst create mode 100644 tests/roots/test-latex-labels-before-module/automodule1.py create mode 100644 tests/roots/test-latex-labels-before-module/automodule2a.py create mode 100644 tests/roots/test-latex-labels-before-module/automodule2b.py create mode 100644 tests/roots/test-latex-labels-before-module/automodule3.py create mode 100644 tests/roots/test-latex-labels-before-module/conf.py create mode 100644 tests/roots/test-latex-labels-before-module/index.rst create mode 100644 tests/roots/test-latex-labels/conf.py create mode 100644 tests/roots/test-latex-labels/index.rst create mode 100644 tests/roots/test-latex-labels/otherdoc.rst create mode 100644 tests/roots/test-latex-numfig/conf.py create mode 100644 tests/roots/test-latex-numfig/index.rst create mode 100644 tests/roots/test-latex-numfig/indexhowto.rst create mode 100644 tests/roots/test-latex-numfig/indexmanual.rst create mode 100644 tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t create mode 100644 tests/roots/test-latex-table/complex.rst create mode 100644 tests/roots/test-latex-table/conf.py create mode 100644 tests/roots/test-latex-table/expects/complex_spanning_cell.tex create mode 100644 tests/roots/test-latex-table/expects/gridtable.tex create mode 100644 tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex create mode 100644 tests/roots/test-latex-table/expects/longtable.tex create mode 100644 tests/roots/test-latex-table/expects/longtable_having_align.tex create mode 100644 tests/roots/test-latex-table/expects/longtable_having_caption.tex create mode 100644 tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex create mode 100644 tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex create mode 100644 tests/roots/test-latex-table/expects/longtable_having_verbatim.tex create mode 100644 tests/roots/test-latex-table/expects/longtable_having_widths.tex create mode 100644 tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex create mode 100644 tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex create mode 100644 tests/roots/test-latex-table/expects/simple_table.tex create mode 100644 tests/roots/test-latex-table/expects/table_having_caption.tex create mode 100644 tests/roots/test-latex-table/expects/table_having_problematic_cell.tex create mode 100644 tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex create mode 100644 tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex create mode 100644 tests/roots/test-latex-table/expects/table_having_verbatim.tex create mode 100644 tests/roots/test-latex-table/expects/table_having_widths.tex create mode 100644 tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex create mode 100644 tests/roots/test-latex-table/expects/tabular_having_widths.tex create mode 100644 tests/roots/test-latex-table/expects/tabularcolumn.tex create mode 100644 tests/roots/test-latex-table/expects/tabulary_having_widths.tex create mode 100644 tests/roots/test-latex-table/index.rst create mode 100644 tests/roots/test-latex-table/longtable.rst create mode 100644 tests/roots/test-latex-table/tabular.rst create mode 100644 tests/roots/test-latex-theme/conf.py create mode 100644 tests/roots/test-latex-theme/index.rst create mode 100644 tests/roots/test-latex-theme/theme/custom/theme.conf create mode 100644 tests/roots/test-latex-title/conf.py create mode 100644 tests/roots/test-latex-title/index.rst create mode 100644 tests/roots/test-latex-unicode/conf.py create mode 100644 tests/roots/test-latex-unicode/index.rst create mode 100644 tests/roots/test-linkcheck-anchors-ignore-for-url/conf.py create mode 100644 tests/roots/test-linkcheck-anchors-ignore-for-url/index.rst create mode 100644 tests/roots/test-linkcheck-anchors-ignore/conf.py create mode 100644 tests/roots/test-linkcheck-anchors-ignore/index.rst create mode 100644 tests/roots/test-linkcheck-documents_exclude/br0ken_link.rst create mode 100644 tests/roots/test-linkcheck-documents_exclude/broken_link.rst create mode 100644 tests/roots/test-linkcheck-documents_exclude/conf.py create mode 100644 tests/roots/test-linkcheck-documents_exclude/index.rst create mode 100644 tests/roots/test-linkcheck-localserver-anchor/conf.py create mode 100644 tests/roots/test-linkcheck-localserver-anchor/index.rst create mode 100644 tests/roots/test-linkcheck-localserver-https/conf.py create mode 100644 tests/roots/test-linkcheck-localserver-https/index.rst create mode 100644 tests/roots/test-linkcheck-localserver-warn-redirects/conf.py create mode 100644 tests/roots/test-linkcheck-localserver-warn-redirects/index.rst create mode 100644 tests/roots/test-linkcheck-localserver/conf.py create mode 100644 tests/roots/test-linkcheck-localserver/index.rst create mode 100644 tests/roots/test-linkcheck-raw-node/conf.py create mode 100644 tests/roots/test-linkcheck-raw-node/index.rst create mode 100644 tests/roots/test-linkcheck-too-many-retries/conf.py create mode 100644 tests/roots/test-linkcheck-too-many-retries/index.rst create mode 100644 tests/roots/test-linkcheck/conf.py create mode 100644 tests/roots/test-linkcheck/links.rst create mode 100644 tests/roots/test-local-logo/conf.py create mode 100644 tests/roots/test-local-logo/images/img.png create mode 100644 tests/roots/test-local-logo/index.rst create mode 100644 tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.mo create mode 100644 tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.po create mode 100644 tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.mo create mode 100644 tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.po create mode 100644 tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.mo create mode 100644 tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.po create mode 100644 tests/roots/test-manpage_url/conf.py create mode 100644 tests/roots/test-manpage_url/index.rst create mode 100644 tests/roots/test-markup-citation/conf.py create mode 100644 tests/roots/test-markup-citation/index.rst create mode 100644 tests/roots/test-markup-rubric/conf.py create mode 100644 tests/roots/test-markup-rubric/index.rst create mode 100644 tests/roots/test-maxlistdepth/conf.py create mode 100644 tests/roots/test-maxlistdepth/index.rst create mode 100644 tests/roots/test-metadata/conf.py create mode 100644 tests/roots/test-metadata/index.rst create mode 100644 tests/roots/test-need-escaped/bar.rst create mode 100644 tests/roots/test-need-escaped/baz.rst create mode 100644 tests/roots/test-need-escaped/conf.py create mode 100644 tests/roots/test-need-escaped/foo.rst create mode 100644 tests/roots/test-need-escaped/index.rst create mode 100644 tests/roots/test-need-escaped/quux.rst create mode 100644 tests/roots/test-need-escaped/qux.rst create mode 100644 tests/roots/test-nested-enumerated-list/conf.py create mode 100644 tests/roots/test-nested-enumerated-list/index.rst create mode 100644 tests/roots/test-nested-tables/conf.py create mode 100644 tests/roots/test-nested-tables/index.rst create mode 100644 tests/roots/test-nitpicky-warnings/conf.py create mode 100644 tests/roots/test-nitpicky-warnings/index.rst create mode 100644 tests/roots/test-numbered-circular/conf.py create mode 100644 tests/roots/test-numbered-circular/index.rst create mode 100644 tests/roots/test-numbered-circular/sub.rst create mode 100644 tests/roots/test-numfig/bar.rst create mode 100644 tests/roots/test-numfig/baz.rst create mode 100644 tests/roots/test-numfig/conf.py create mode 100644 tests/roots/test-numfig/foo.rst create mode 100644 tests/roots/test-numfig/index.rst create mode 100644 tests/roots/test-numfig/rimg.png create mode 100644 tests/roots/test-object-description-sections/conf.py create mode 100644 tests/roots/test-object-description-sections/index.rst create mode 100644 tests/roots/test-productionlist/Bare.rst create mode 100644 tests/roots/test-productionlist/Dup1.rst create mode 100644 tests/roots/test-productionlist/Dup2.rst create mode 100644 tests/roots/test-productionlist/LineContinuation.rst create mode 100644 tests/roots/test-productionlist/P1.rst create mode 100644 tests/roots/test-productionlist/P2.rst create mode 100644 tests/roots/test-productionlist/conf.py create mode 100644 tests/roots/test-productionlist/firstLineRule.rst create mode 100644 tests/roots/test-productionlist/index.rst create mode 100644 tests/roots/test-prolog/conf.py create mode 100644 tests/roots/test-prolog/index.rst create mode 100644 tests/roots/test-prolog/markdown.md create mode 100644 tests/roots/test-prolog/prolog_markdown_parser.py create mode 100644 tests/roots/test-prolog/restructuredtext.rst create mode 100644 tests/roots/test-pycode/cp_1251_coded.py create mode 100644 tests/roots/test-reST-code-block/conf.py create mode 100644 tests/roots/test-reST-code-block/index.rst create mode 100644 tests/roots/test-reST-code-role/conf.py create mode 100644 tests/roots/test-reST-code-role/index.rst create mode 100644 tests/roots/test-refonly_bullet_list/conf.py create mode 100644 tests/roots/test-refonly_bullet_list/index.rst create mode 100644 tests/roots/test-remote-logo/conf.py create mode 100644 tests/roots/test-remote-logo/index.rst create mode 100644 tests/roots/test-roles-download/another/dummy.dat create mode 100644 tests/roots/test-roles-download/conf.py create mode 100644 tests/roots/test-roles-download/dummy.dat create mode 100644 tests/roots/test-roles-download/index.rst create mode 100644 tests/roots/test-root/Makefile create mode 100644 tests/roots/test-root/_templates/contentssb.html create mode 100644 tests/roots/test-root/_templates/customsb.html create mode 100644 tests/roots/test-root/_templates/layout.html create mode 100644 tests/roots/test-root/autodoc.txt create mode 100644 tests/roots/test-root/autodoc_target.py create mode 100644 tests/roots/test-root/bom.txt create mode 100644 tests/roots/test-root/conf.py create mode 100644 tests/roots/test-root/extapi.txt create mode 100644 tests/roots/test-root/extensions.txt create mode 100644 tests/roots/test-root/file_with_special_#_chars.xyz create mode 100644 tests/roots/test-root/footnote.txt create mode 100644 tests/roots/test-root/images.txt create mode 100644 tests/roots/test-root/img.foo.png create mode 100644 tests/roots/test-root/img.gif create mode 100644 tests/roots/test-root/img.pdf create mode 100644 tests/roots/test-root/img.png create mode 100644 tests/roots/test-root/includes.txt create mode 100644 tests/roots/test-root/index.txt create mode 100644 tests/roots/test-root/lists.txt create mode 100644 tests/roots/test-root/literal.inc create mode 100644 tests/roots/test-root/literal_orig.inc create mode 100644 tests/roots/test-root/markup.txt create mode 100644 tests/roots/test-root/math.txt create mode 100644 tests/roots/test-root/objects.txt create mode 100644 tests/roots/test-root/otherext.foo create mode 100644 tests/roots/test-root/parsermod.py create mode 100644 tests/roots/test-root/quotes.inc create mode 100644 tests/roots/test-root/rimg.png create mode 100644 tests/roots/test-root/special/api.h create mode 100644 tests/roots/test-root/special/code.py create mode 100644 tests/roots/test-root/subdir/excluded.txt create mode 100644 tests/roots/test-root/subdir/images.txt create mode 100644 tests/roots/test-root/subdir/img.png create mode 100644 tests/roots/test-root/subdir/include.inc create mode 100644 tests/roots/test-root/subdir/includes.txt create mode 100644 tests/roots/test-root/subdir/simg.png create mode 100644 tests/roots/test-root/svgimg.pdf create mode 100644 tests/roots/test-root/svgimg.svg create mode 100644 tests/roots/test-root/tabs.inc create mode 100644 tests/roots/test-root/test.inc create mode 100644 tests/roots/test-root/wrongenc.inc create mode 100644 tests/roots/test-search/conf.py create mode 100644 tests/roots/test-search/index.rst create mode 100644 tests/roots/test-search/nosearch.rst create mode 100644 tests/roots/test-search/tocitem.rst create mode 100644 tests/roots/test-smartquotes/conf.py create mode 100644 tests/roots/test-smartquotes/index.rst create mode 100644 tests/roots/test-smartquotes/literals.rst create mode 100644 tests/roots/test-stylesheets/_templates/layout.html create mode 100644 tests/roots/test-stylesheets/conf.py create mode 100644 tests/roots/test-stylesheets/index.rst create mode 100644 tests/roots/test-templating/_templates/autosummary/class.rst create mode 100644 tests/roots/test-templating/_templates/layout.html create mode 100644 tests/roots/test-templating/autosummary_templating.txt create mode 100644 tests/roots/test-templating/conf.py create mode 100644 tests/roots/test-templating/index.txt create mode 100644 tests/roots/test-theming/child.zip create mode 100644 tests/roots/test-theming/conf.py create mode 100644 tests/roots/test-theming/index.rst create mode 100644 tests/roots/test-theming/parent.zip create mode 100644 tests/roots/test-theming/test_theme/__init__.py create mode 100644 tests/roots/test-theming/test_theme/staticfiles/layout.html create mode 100644 tests/roots/test-theming/test_theme/staticfiles/static/staticimg.png create mode 100644 tests/roots/test-theming/test_theme/staticfiles/static/statictmpl.html_t create mode 100644 tests/roots/test-theming/test_theme/staticfiles/theme.conf create mode 100644 tests/roots/test-theming/test_theme/test-theme/theme.conf create mode 100644 tests/roots/test-theming/ziptheme.zip create mode 100644 tests/roots/test-tocdepth/bar.rst create mode 100644 tests/roots/test-tocdepth/baz.rst create mode 100644 tests/roots/test-tocdepth/conf.py create mode 100644 tests/roots/test-tocdepth/foo.rst create mode 100644 tests/roots/test-tocdepth/index.rst create mode 100644 tests/roots/test-toctree-domain-objects/conf.py create mode 100644 tests/roots/test-toctree-domain-objects/domains.rst create mode 100644 tests/roots/test-toctree-domain-objects/index.rst create mode 100644 tests/roots/test-toctree-duplicated/conf.py create mode 100644 tests/roots/test-toctree-duplicated/foo.rst create mode 100644 tests/roots/test-toctree-duplicated/index.rst create mode 100644 tests/roots/test-toctree-empty/_templates/localtoc.html create mode 100644 tests/roots/test-toctree-empty/conf.py create mode 100644 tests/roots/test-toctree-empty/index.rst create mode 100644 tests/roots/test-toctree-glob/bar/bar_1.rst create mode 100644 tests/roots/test-toctree-glob/bar/bar_2.rst create mode 100644 tests/roots/test-toctree-glob/bar/bar_3.rst create mode 100644 tests/roots/test-toctree-glob/bar/bar_4/index.rst create mode 100644 tests/roots/test-toctree-glob/bar/index.rst create mode 100644 tests/roots/test-toctree-glob/baz.rst create mode 100644 tests/roots/test-toctree-glob/conf.py create mode 100644 tests/roots/test-toctree-glob/foo.rst create mode 100644 tests/roots/test-toctree-glob/index.rst create mode 100644 tests/roots/test-toctree-glob/quux.rst create mode 100644 tests/roots/test-toctree-glob/qux/index.rst create mode 100644 tests/roots/test-toctree-glob/qux/qux_1.rst create mode 100644 tests/roots/test-toctree-glob/qux/qux_2.rst create mode 100644 tests/roots/test-toctree-index/conf.py create mode 100644 tests/roots/test-toctree-index/foo.rst create mode 100644 tests/roots/test-toctree-index/index.rst create mode 100644 tests/roots/test-toctree-maxdepth/bar.rst create mode 100644 tests/roots/test-toctree-maxdepth/baz.rst create mode 100644 tests/roots/test-toctree-maxdepth/conf.py create mode 100644 tests/roots/test-toctree-maxdepth/foo.rst create mode 100644 tests/roots/test-toctree-maxdepth/index.rst create mode 100644 tests/roots/test-toctree-maxdepth/qux.rst create mode 100644 tests/roots/test-toctree/bar.rst create mode 100644 tests/roots/test-toctree/baz.rst create mode 100644 tests/roots/test-toctree/conf.py create mode 100644 tests/roots/test-toctree/foo.rst create mode 100644 tests/roots/test-toctree/index.rst create mode 100644 tests/roots/test-toctree/quux.rst create mode 100644 tests/roots/test-toctree/qux.rst create mode 100644 tests/roots/test-toctree/tocdepth.rst create mode 100644 tests/roots/test-transforms-post_transforms-keyboard/conf.py create mode 100644 tests/roots/test-transforms-post_transforms-keyboard/index.rst create mode 100644 tests/roots/test-transforms-post_transforms-missing-reference/conf.py create mode 100644 tests/roots/test-transforms-post_transforms-missing-reference/index.rst create mode 100644 tests/roots/test-trim_doctest_flags/conf.py create mode 100644 tests/roots/test-trim_doctest_flags/index.rst create mode 100644 tests/roots/test-versioning/added.txt create mode 100644 tests/roots/test-versioning/conf.py create mode 100644 tests/roots/test-versioning/deleted.txt create mode 100644 tests/roots/test-versioning/deleted_end.txt create mode 100644 tests/roots/test-versioning/index.txt create mode 100644 tests/roots/test-versioning/insert.txt create mode 100644 tests/roots/test-versioning/insert_beginning.txt create mode 100644 tests/roots/test-versioning/insert_similar.txt create mode 100644 tests/roots/test-versioning/modified.txt create mode 100644 tests/roots/test-versioning/original.txt create mode 100644 tests/roots/test-warnings/autodoc_fodder.py create mode 100644 tests/roots/test-warnings/conf.py create mode 100644 tests/roots/test-warnings/index.rst create mode 100644 tests/roots/test-warnings/svgimg.pdf create mode 100644 tests/roots/test-warnings/svgimg.svg create mode 100644 tests/roots/test-warnings/undecodable.rst create mode 100644 tests/roots/test-warnings/wrongenc.inc create mode 100644 tests/test_addnodes.py create mode 100644 tests/test_api_translator.py create mode 100644 tests/test_application.py create mode 100644 tests/test_build.py create mode 100644 tests/test_build_changes.py create mode 100644 tests/test_build_dirhtml.py create mode 100644 tests/test_build_epub.py create mode 100644 tests/test_build_gettext.py create mode 100644 tests/test_build_html.py create mode 100644 tests/test_build_latex.py create mode 100644 tests/test_build_linkcheck.py create mode 100644 tests/test_build_manpage.py create mode 100644 tests/test_build_texinfo.py create mode 100644 tests/test_build_text.py create mode 100644 tests/test_builder.py create mode 100644 tests/test_catalogs.py create mode 100644 tests/test_config.py create mode 100644 tests/test_correct_year.py create mode 100644 tests/test_directive_code.py create mode 100644 tests/test_directive_object_description.py create mode 100644 tests/test_directive_only.py create mode 100644 tests/test_directive_other.py create mode 100644 tests/test_directive_patch.py create mode 100644 tests/test_directives_no_typesetting.py create mode 100644 tests/test_docutilsconf.py create mode 100644 tests/test_domain_c.py create mode 100644 tests/test_domain_cpp.py create mode 100644 tests/test_domain_js.py create mode 100644 tests/test_domain_py.py create mode 100644 tests/test_domain_rst.py create mode 100644 tests/test_domain_std.py create mode 100644 tests/test_environment.py create mode 100644 tests/test_environment_indexentries.py create mode 100644 tests/test_environment_record_dependencies.py create mode 100644 tests/test_environment_toctree.py create mode 100644 tests/test_errors.py create mode 100644 tests/test_events.py create mode 100644 tests/test_ext_apidoc.py create mode 100644 tests/test_ext_autodoc.py create mode 100644 tests/test_ext_autodoc_autoattribute.py create mode 100644 tests/test_ext_autodoc_autoclass.py create mode 100644 tests/test_ext_autodoc_autodata.py create mode 100644 tests/test_ext_autodoc_autofunction.py create mode 100644 tests/test_ext_autodoc_automodule.py create mode 100644 tests/test_ext_autodoc_autoproperty.py create mode 100644 tests/test_ext_autodoc_configs.py create mode 100644 tests/test_ext_autodoc_events.py create mode 100644 tests/test_ext_autodoc_mock.py create mode 100644 tests/test_ext_autodoc_preserve_defaults.py create mode 100644 tests/test_ext_autodoc_private_members.py create mode 100644 tests/test_ext_autosectionlabel.py create mode 100644 tests/test_ext_autosummary.py create mode 100644 tests/test_ext_coverage.py create mode 100644 tests/test_ext_doctest.py create mode 100644 tests/test_ext_duration.py create mode 100644 tests/test_ext_extlinks.py create mode 100644 tests/test_ext_githubpages.py create mode 100644 tests/test_ext_graphviz.py create mode 100644 tests/test_ext_ifconfig.py create mode 100644 tests/test_ext_imgconverter.py create mode 100644 tests/test_ext_imgmockconverter.py create mode 100644 tests/test_ext_inheritance_diagram.py create mode 100644 tests/test_ext_intersphinx.py create mode 100644 tests/test_ext_math.py create mode 100644 tests/test_ext_napoleon.py create mode 100644 tests/test_ext_napoleon_docstring.py create mode 100644 tests/test_ext_todo.py create mode 100644 tests/test_ext_viewcode.py create mode 100644 tests/test_extension.py create mode 100644 tests/test_highlighting.py create mode 100644 tests/test_intl.py create mode 100644 tests/test_locale.py create mode 100644 tests/test_markup.py create mode 100644 tests/test_metadata.py create mode 100644 tests/test_parser.py create mode 100644 tests/test_project.py create mode 100644 tests/test_pycode.py create mode 100644 tests/test_pycode_ast.py create mode 100644 tests/test_pycode_parser.py create mode 100644 tests/test_quickstart.py create mode 100644 tests/test_roles.py create mode 100644 tests/test_search.py create mode 100644 tests/test_smartquotes.py create mode 100644 tests/test_templating.py create mode 100644 tests/test_theming.py create mode 100644 tests/test_toctree.py create mode 100644 tests/test_transforms_move_module_targets.py create mode 100644 tests/test_transforms_post_transforms.py create mode 100644 tests/test_transforms_post_transforms_code.py create mode 100644 tests/test_transforms_reorder_nodes.py create mode 100644 tests/test_util.py create mode 100644 tests/test_util_display.py create mode 100644 tests/test_util_docstrings.py create mode 100644 tests/test_util_docutils.py create mode 100644 tests/test_util_fileutil.py create mode 100644 tests/test_util_i18n.py create mode 100644 tests/test_util_images.py create mode 100644 tests/test_util_inspect.py create mode 100644 tests/test_util_inventory.py create mode 100644 tests/test_util_logging.py create mode 100644 tests/test_util_matching.py create mode 100644 tests/test_util_nodes.py create mode 100644 tests/test_util_rst.py create mode 100644 tests/test_util_template.py create mode 100644 tests/test_util_typing.py create mode 100644 tests/test_versioning.py create mode 100644 tests/test_writer_latex.py create mode 100644 tests/typing_test_data.py create mode 100644 tests/utils.py (limited to 'tests') diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/certs/cert.pem b/tests/certs/cert.pem new file mode 100644 index 0000000..6f8c35c --- /dev/null +++ b/tests/certs/cert.pem @@ -0,0 +1,50 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC9fzHGBPNaZNcN +nL/1nvO2xJR/E64vFua3QfPQQ5HpigjrK/HRUlRGztRKJ+CEjCXNYNfQ4dUcV45o +k5uPH3U1CkAw2d/We+kZnAHkNuw4mRC0ohdzpUByyDOA5WtUWPn9SwhXCVz6fM7e +I52auvzpUE6soVDM3nucnqZDJ3Ua9KgB02FrqX13S76Uq+uf8Q2hpTruO/nBzB4p +6xFwJJ1taXEEWi8swg6HO8/+0x0AeripV6JieNUptEFuV9kLvRz9qGg0CO2f7AdI +jNeFDGrgO7qJ+VxXV9Gnbi6ph4vsUwtJZB3phRGGomdgiRd6PSma81nvTe1z69x/ +g+8P091pAgMBAAECggEAIrTABfd0JpMffAPAeJjjJA8+70NIfKFiIiA3Kmalu7Mn +TQMgZ+j/PHS3FtnU2hHc/o+FF2G1KVqz311heUYWrl8xQIE26M6K88DJ6+VPQFJw +Z9TkHK8gbaVTIYFjNfCR4J00atRxLgNb0/2L6QHkPksSDbYB2XPKCfZYlyYL4aKq +dePghFu9ePXhUXooPCqke+kP0b8OmHzPlmJpxbeb8ujiox2+4wYjN8lWPz8xHv8i +IM7V5hAbPIaQfu/joKrRKk+Kk8UqGurkKQ75KLLL+1oaJO/GLTQ4bk5tpRgfWPda +aEBzSPrnqame2CKUWtBughuRWSxdTIMvdXIC/ym1gQKBgQDx6Nyio/L6I5CdlXwC +HAzBCy1mnj70Kj97tQc+A/0z8dD7fCSE/oo8IiEKixcjnaSxHk8VjINF/w17n63W +8neE7pVsuDwxfhiQ9ZRI1WpV0LsFEoTrEWG7Ax8UzbHXCQbNJ9SI0HJRo9UN0f/Z +t+ZT+HNUzdcpCwTvdRVDisbXcQKBgQDIiMz58GFEwdGPXJKEhSyQ3kSQBjeqo0Vl +wMDuDvFEckHl/p1RnDo0lzaq6FivOX84ymvGNdQW14TnQp3A/mkQ5o6k/e1pfAA6 +X0Y6tBH/QppVo5sFvOufyn02k48k5pFAjLHH9L9i0dyWqq4V6PgA2uk4qilFxEg/ +CJEVfq4ZeQKBgQCZPHKWq9f8T48J42kcRPxnRFdMC63BKQnxqOifhhNcVi+VPjw7 +6qlSEiRv80+DBhcPAy4BbnKxYjD+QFX0NL80+5S3u7SVfVS+bnGx+U5UcdYmDmcY +KHiJ6B5GJU4j8tnWFwbwa2ofAPKywHWbSnyicF1OON20aACGVtpTYJM4YQKBgBW4 +09NDGZY0FHoeAfT+4/vxR6X+NmtyciL6hSuETNgoNEEwmmPrs1ZdBtvufSTF6qUB +MDlxPT8YK1pNmf78z+63ur3ej6f8eZ3ZEidruANZeJRMO4+cjj1p1rRhuYC6xQMj ++mH5ff27U9SyOlc/PBYDoH212PCouVaym9yjM0KpAoGBALr583slY55ESOthLrfX +1ecoET5xxRm431XbZMnxu0uUvHWNfqoojtmD7laclb9HwkpShPB6PT1egBIvDWWM +bVUuXzJ8gP0tIG3dHgiiUlld3ahOiaMYSU77uLFBRWv5sQqfewLuFvlzHn/2ZSt7 +TcipT4f67b18W8iuLJELEs57 +-----END PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIIDuTCCAqGgAwIBAgIUUNvkPwe0W8C2I0+KnLpMaQ+S+vowDQYJKoZIhvcNAQEL +BQAwYTELMAkGA1UEBhMCRlIxETAPBgNVBAgMCEJyZXRhZ25lMQ8wDQYDVQQHDAZS +ZW5uZXMxGjAYBgNVBAoMEVNwaGlueCB0ZXN0IHN1aXRlMRIwEAYDVQQDDAlsb2Nh +bGhvc3QwHhcNMjAxMTE1MTcyNDExWhcNMzAxMTEzMTcyNDExWjBhMQswCQYDVQQG +EwJGUjERMA8GA1UECAwIQnJldGFnbmUxDzANBgNVBAcMBlJlbm5lczEaMBgGA1UE +CgwRU3BoaW54IHRlc3Qgc3VpdGUxEjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBAL1/McYE81pk1w2cv/We87bElH8Tri8W +5rdB89BDkemKCOsr8dFSVEbO1Eon4ISMJc1g19Dh1RxXjmiTm48fdTUKQDDZ39Z7 +6RmcAeQ27DiZELSiF3OlQHLIM4Dla1RY+f1LCFcJXPp8zt4jnZq6/OlQTqyhUMze +e5yepkMndRr0qAHTYWupfXdLvpSr65/xDaGlOu47+cHMHinrEXAknW1pcQRaLyzC +Doc7z/7THQB6uKlXomJ41Sm0QW5X2Qu9HP2oaDQI7Z/sB0iM14UMauA7uon5XFdX +0aduLqmHi+xTC0lkHemFEYaiZ2CJF3o9KZrzWe9N7XPr3H+D7w/T3WkCAwEAAaNp +MGcwHQYDVR0OBBYEFN1iHZj88N6eI2FlRzza52xzOU5EMB8GA1UdIwQYMBaAFN1i +HZj88N6eI2FlRzza52xzOU5EMA8GA1UdEwEB/wQFMAMBAf8wFAYDVR0RBA0wC4IJ +bG9jYWxob3N0MA0GCSqGSIb3DQEBCwUAA4IBAQBVUZm1iw7N7uZu/SF3hailxS+1 +3KChItWu3ZOIjlmDIkaJ9kWqP2ficUg3tBUx6/UOjHQAwRC4rj87BoSV2mEy+0OX +fyy+ER/BeHYly5v+hpjVojVKeqysk5CKttZM+cOibT2SzLLYf0InNqZRQRJco+nL +QNR0hVo/Lz6Mf1gF2ywf9bXSF3+XECU4K6sVm4QpFbJNm+fHqJBuh1LXHRrcTAsP +LM6PBnd3P5QTcr/G0s/tYMPmero9YHZUO8FMvMVoI2K8k6/duG/EbBaNzriRI1OM +PpZGCWxbJfyApnzc5lGAG4zJnV/wpOyNhKJuW9N1fr2oEwPpJlS3VzrgeKcY +-----END CERTIFICATE----- diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..1b909bd --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,40 @@ +import os +from pathlib import Path + +import docutils +import pytest + +import sphinx +import sphinx.locale + + +def _init_console(locale_dir=sphinx.locale._LOCALE_DIR, catalog='sphinx'): + """Monkeypatch ``init_console`` to skip its action. + + Some tests rely on warning messages in English. We don't want + CLI tests to bleed over those tests and make their warnings + translated. + """ + return sphinx.locale.NullTranslations(), False + + +sphinx.locale.init_console = _init_console + +pytest_plugins = 'sphinx.testing.fixtures' + +# Exclude 'roots' dirs for pytest test collector +collect_ignore = ['roots'] + +os.environ['SPHINX_AUTODOC_RELOAD_MODULES'] = '1' + + +@pytest.fixture(scope='session') +def rootdir(): + return Path(__file__).parent.absolute() / 'roots' + + +def pytest_report_header(config): + header = f"libraries: Sphinx-{sphinx.__display_version__}, docutils-{docutils.__version__}" + if hasattr(config, '_tmp_path_factory'): + header += f"\nbase tmp_path: {config._tmp_path_factory.getbasetemp()}" + return header diff --git a/tests/ext_napoleon_pep526_data_google.py b/tests/ext_napoleon_pep526_data_google.py new file mode 100644 index 0000000..bb55b0f --- /dev/null +++ b/tests/ext_napoleon_pep526_data_google.py @@ -0,0 +1,16 @@ +"""Test module for napoleon PEP 526 compatibility with google style""" + +module_level_var: int = 99 +"""This is an example module level variable""" + + +class PEP526GoogleClass: + """Sample class with PEP 526 annotations and google docstring + + Attributes: + attr1: Attr1 description. + attr2: Attr2 description. + """ + + attr1: int + attr2: str diff --git a/tests/ext_napoleon_pep526_data_numpy.py b/tests/ext_napoleon_pep526_data_numpy.py new file mode 100644 index 0000000..b3093a7 --- /dev/null +++ b/tests/ext_napoleon_pep526_data_numpy.py @@ -0,0 +1,20 @@ +"""Test module for napoleon PEP 526 compatibility with numpy style""" + +module_level_var: int = 99 +"""This is an example module level variable""" + + +class PEP526NumpyClass: + """ + Sample class with PEP 526 annotations and numpy docstring + + Attributes + ---------- + attr1: + Attr1 description + + attr2: + Attr2 description + """ + attr1: int + attr2: str diff --git a/tests/js/documentation_options.js b/tests/js/documentation_options.js new file mode 100644 index 0000000..e736460 --- /dev/null +++ b/tests/js/documentation_options.js @@ -0,0 +1 @@ +const DOCUMENTATION_OPTIONS = {}; diff --git a/tests/js/searchtools.js b/tests/js/searchtools.js new file mode 100644 index 0000000..c9e0c43 --- /dev/null +++ b/tests/js/searchtools.js @@ -0,0 +1,62 @@ +describe('Basic html theme search', function() { + + describe('terms search', function() { + + it('should find "C++" when in index', function() { + index = { + docnames:["index"], + filenames:["index.rst"], + terms:{'c++':0}, + titles:["<no title>"], + titleterms:{} + } + Search.setIndex(index); + searchterms = ['c++']; + excluded = []; + terms = index.terms; + titleterms = index.titleterms; + + hits = [[ + "index", + "<no title>", + "", + null, + 2, + "index.rst" + ]]; + expect(Search.performTermsSearch(searchterms, excluded, terms, titleterms)).toEqual(hits); + }); + + }); + +}); + +// This is regression test for https://github.com/sphinx-doc/sphinx/issues/3150 +describe('splitQuery regression tests', () => { + + it('can split English words', () => { + const parts = splitQuery(' Hello World ') + expect(parts).toEqual(['Hello', 'World']) + }) + + it('can split special characters', () => { + const parts = splitQuery('Pin-Code') + expect(parts).toEqual(['Pin', 'Code']) + }) + + it('can split Chinese characters', () => { + const parts = splitQuery('Hello from 中国 上海') + expect(parts).toEqual(['Hello', 'from', '中国', '上海']) + }) + + it('can split Emoji (surrogate pair) characters. It should keep emojis.', () => { + const parts = splitQuery('😁😁') + expect(parts).toEqual(['😁😁']) + }) + + it('can split umlauts. It should keep umlauts.', () => { + const parts = splitQuery('Löschen Prüfung Abändern ærlig spørsmål') + expect(parts).toEqual(['Löschen', 'Prüfung', 'Abändern', 'ærlig', 'spørsmål']) + }) + +}) diff --git a/tests/js/sphinx_highlight.js b/tests/js/sphinx_highlight.js new file mode 100644 index 0000000..1f52eab --- /dev/null +++ b/tests/js/sphinx_highlight.js @@ -0,0 +1,39 @@ +describe('highlightText', function() { + + const cyrillicTerm = 'шеллы'; + const umlautTerm = 'gänsefüßchen'; + + it('should highlight text incl. special characters correctly in HTML', function() { + const highlightTestSpan = new DOMParser().parseFromString( + 'This is the шеллы and Gänsefüßchen test!', 'text/html').body.firstChild + _highlightText(highlightTestSpan, cyrillicTerm, 'highlighted'); + _highlightText(highlightTestSpan, umlautTerm, 'highlighted'); + const expectedHtmlString = + 'This is the шеллы and ' + + 'Gänsefüßchen test!'; + expect(highlightTestSpan.innerHTML).toEqual(expectedHtmlString); + }); + + it('should highlight text incl. special characters correctly in SVG', function() { + const highlightTestSvg = new DOMParser().parseFromString( + '' + + '' + + '' + + 'This is the шеллы and Gänsefüßchen test!' + + '' + + '' + + '', 'text/html').body.firstChild + _highlightText(highlightTestSvg, cyrillicTerm, 'highlighted'); + _highlightText(highlightTestSvg, umlautTerm, 'highlighted'); + /* Note wild cards and ``toMatch``; allowing for some variability + seems to be necessary, even between different FF versions */ + const expectedSvgString = + '' + + '' + + '' + + 'This is the шеллы and ' + + 'Gänsefüßchen test!'; + expect(new XMLSerializer().serializeToString(highlightTestSvg.firstChild)).toMatch(new RegExp(expectedSvgString)); + }); + +}); diff --git a/tests/roots/test-add_enumerable_node/conf.py b/tests/roots/test-add_enumerable_node/conf.py new file mode 100644 index 0000000..8c3a568 --- /dev/null +++ b/tests/roots/test-add_enumerable_node/conf.py @@ -0,0 +1,7 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) +extensions = ['enumerable_node'] + +numfig = True diff --git a/tests/roots/test-add_enumerable_node/enumerable_node.py b/tests/roots/test-add_enumerable_node/enumerable_node.py new file mode 100644 index 0000000..782365e --- /dev/null +++ b/tests/roots/test-add_enumerable_node/enumerable_node.py @@ -0,0 +1,62 @@ +from docutils import nodes +from docutils.parsers.rst import Directive + + +class my_figure(nodes.figure): + pass + + +def visit_my_figure(self, node): + self.visit_figure(node) + + +def depart_my_figure(self, node): + self.depart_figure(node) + + +class MyFigure(Directive): + required_arguments = 1 + has_content = True + + def run(self): + figure_node = my_figure() + figure_node += nodes.image(uri=self.arguments[0]) + figure_node += nodes.caption(text=''.join(self.content)) + return [figure_node] + + +class numbered_text(nodes.Element): + pass + + +def visit_numbered_text(self, node): + self.body.append(self.starttag(node, 'div')) + self.add_fignumber(node) + self.body.append(node['title']) + self.body.append('') + raise nodes.SkipNode + + +def get_title(node): + return node['title'] + + +class NumberedText(Directive): + required_arguments = 1 + final_argument_whitespace = True + + def run(self): + return [numbered_text(title=self.arguments[0])] + + +def setup(app): + # my-figure + app.add_enumerable_node(my_figure, 'figure', + html=(visit_my_figure, depart_my_figure)) + app.add_directive('my-figure', MyFigure) + + # numbered_label + app.add_enumerable_node(numbered_text, 'original', get_title, + html=(visit_numbered_text, None)) + app.add_directive('numbered-text', NumberedText) + app.config.numfig_format.setdefault('original', 'No.%s') diff --git a/tests/roots/test-add_enumerable_node/index.rst b/tests/roots/test-add_enumerable_node/index.rst new file mode 100644 index 0000000..98b858e --- /dev/null +++ b/tests/roots/test-add_enumerable_node/index.rst @@ -0,0 +1,48 @@ +======================== +test-add_enumerable_node +======================== + +.. toctree:: + :numbered: + + +First section +============= + +.. _first_figure: + +.. figure:: rimg.png + + First figure + +.. _first_my_figure: + +.. my-figure:: rimg.png + + First my figure + +.. _first_numbered_text: + +.. numbered-text:: Hello world + +.. _second_numbered_text: + +.. numbered-text:: Hello Sphinx + +Second section +============== + +.. _second_my_figure: + +.. my-figure:: rimg.png + + Second my figure + +Reference section +================= + +* first_figure is :numref:`first_figure` +* first_my_figure is :numref:`first_my_figure` +* second_my_figure is :numref:`second_my_figure` +* first numbered_text is :numref:`first_numbered_text` +* second numbered_text is :numref:`second_numbered_text` diff --git a/tests/roots/test-add_enumerable_node/rimg.png b/tests/roots/test-add_enumerable_node/rimg.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-add_enumerable_node/rimg.png differ diff --git a/tests/roots/test-add_source_parser-conflicts-with-users-setting/conf.py b/tests/roots/test-add_source_parser-conflicts-with-users-setting/conf.py new file mode 100644 index 0000000..3ad5491 --- /dev/null +++ b/tests/roots/test-add_source_parser-conflicts-with-users-setting/conf.py @@ -0,0 +1,17 @@ +import os +import sys + +from docutils.parsers import Parser + +sys.path.insert(0, os.path.abspath('.')) + + +class DummyTestParser(Parser): + supported = ('dummy',) + + +extensions = ['source_parser'] +source_suffix = ['.rst', '.test'] +source_parsers = { + '.test': DummyTestParser +} diff --git a/tests/roots/test-add_source_parser-conflicts-with-users-setting/source_parser.py b/tests/roots/test-add_source_parser-conflicts-with-users-setting/source_parser.py new file mode 100644 index 0000000..69ad02d --- /dev/null +++ b/tests/roots/test-add_source_parser-conflicts-with-users-setting/source_parser.py @@ -0,0 +1,10 @@ +from docutils.parsers import Parser + + +class TestSourceParser(Parser): + supported = ('test',) + + +def setup(app): + app.add_source_suffix('.test', 'test') + app.add_source_parser(TestSourceParser) diff --git a/tests/roots/test-add_source_parser/conf.py b/tests/roots/test-add_source_parser/conf.py new file mode 100644 index 0000000..2acd4d2 --- /dev/null +++ b/tests/roots/test-add_source_parser/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + + +extensions = ['source_parser'] +source_suffix = ['.rst'] diff --git a/tests/roots/test-add_source_parser/source_parser.py b/tests/roots/test-add_source_parser/source_parser.py new file mode 100644 index 0000000..69ad02d --- /dev/null +++ b/tests/roots/test-add_source_parser/source_parser.py @@ -0,0 +1,10 @@ +from docutils.parsers import Parser + + +class TestSourceParser(Parser): + supported = ('test',) + + +def setup(app): + app.add_source_suffix('.test', 'test') + app.add_source_parser(TestSourceParser) diff --git a/tests/roots/test-api-set-translator/conf.py b/tests/roots/test-api-set-translator/conf.py new file mode 100644 index 0000000..3b56c39 --- /dev/null +++ b/tests/roots/test-api-set-translator/conf.py @@ -0,0 +1,72 @@ +# set this by test +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +from docutils.writers.docutils_xml import XMLTranslator + +from sphinx.writers.html import HTML5Translator +from sphinx.writers.latex import LaTeXTranslator +from sphinx.writers.manpage import ManualPageTranslator +from sphinx.writers.texinfo import TexinfoTranslator +from sphinx.writers.text import TextTranslator + +project = 'test' + + +class ConfHTMLTranslator(HTML5Translator): + pass + + +class ConfDirHTMLTranslator(HTML5Translator): + pass + + +class ConfSingleHTMLTranslator(HTML5Translator): + pass + + +class ConfPickleTranslator(HTML5Translator): + pass + + +class ConfJsonTranslator(HTML5Translator): + pass + + +class ConfLaTeXTranslator(LaTeXTranslator): + pass + + +class ConfManualPageTranslator(ManualPageTranslator): + pass + + +class ConfTexinfoTranslator(TexinfoTranslator): + pass + + +class ConfTextTranslator(TextTranslator): + pass + + +class ConfXMLTranslator(XMLTranslator): + pass + + +class ConfPseudoXMLTranslator(XMLTranslator): + pass + + +def setup(app): + app.set_translator('html', ConfHTMLTranslator) + app.set_translator('dirhtml', ConfDirHTMLTranslator) + app.set_translator('singlehtml', ConfSingleHTMLTranslator) + app.set_translator('pickle', ConfPickleTranslator) + app.set_translator('json', ConfJsonTranslator) + app.set_translator('latex', ConfLaTeXTranslator) + app.set_translator('man', ConfManualPageTranslator) + app.set_translator('texinfo', ConfTexinfoTranslator) + app.set_translator('text', ConfTextTranslator) + app.set_translator('xml', ConfXMLTranslator) + app.set_translator('pseudoxml', ConfPseudoXMLTranslator) diff --git a/tests/roots/test-api-set-translator/index.rst b/tests/roots/test-api-set-translator/index.rst new file mode 100644 index 0000000..4a7d692 --- /dev/null +++ b/tests/roots/test-api-set-translator/index.rst @@ -0,0 +1,3 @@ +======================= +Test API set_translator +======================= diff --git a/tests/roots/test-api-set-translator/nonext/conf.py b/tests/roots/test-api-set-translator/nonext/conf.py new file mode 100644 index 0000000..f93e4da --- /dev/null +++ b/tests/roots/test-api-set-translator/nonext/conf.py @@ -0,0 +1,6 @@ +import os +import sys + +sys.path.insert(0, os.path.dirname(os.path.abspath('.'))) + +project = 'test' diff --git a/tests/roots/test-api-set-translator/translator.py b/tests/roots/test-api-set-translator/translator.py new file mode 100644 index 0000000..3adbf76 --- /dev/null +++ b/tests/roots/test-api-set-translator/translator.py @@ -0,0 +1,5 @@ +from sphinx.writers.html import HTML5Translator + + +class ExtHTMLTranslator(HTML5Translator): + pass diff --git a/tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so b/tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx b/tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-apidoc-pep420/a/b/c/__init__.py b/tests/roots/test-apidoc-pep420/a/b/c/__init__.py new file mode 100644 index 0000000..5b727c1 --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/c/__init__.py @@ -0,0 +1 @@ +"Package C" diff --git a/tests/roots/test-apidoc-pep420/a/b/c/d.py b/tests/roots/test-apidoc-pep420/a/b/c/d.py new file mode 100644 index 0000000..63b0e34 --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/c/d.py @@ -0,0 +1 @@ +"Module d" diff --git a/tests/roots/test-apidoc-pep420/a/b/e/__init__.py b/tests/roots/test-apidoc-pep420/a/b/e/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-apidoc-pep420/a/b/e/f.py b/tests/roots/test-apidoc-pep420/a/b/e/f.py new file mode 100644 index 0000000..a09affe --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/e/f.py @@ -0,0 +1 @@ +"Module f" diff --git a/tests/roots/test-apidoc-pep420/a/b/x/y.py b/tests/roots/test-apidoc-pep420/a/b/x/y.py new file mode 100644 index 0000000..46bc245 --- /dev/null +++ b/tests/roots/test-apidoc-pep420/a/b/x/y.py @@ -0,0 +1 @@ +"Module y" diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/__init__.py b/tests/roots/test-apidoc-subpackage-in-toc/parent/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/child/__init__.py b/tests/roots/test-apidoc-subpackage-in-toc/parent/child/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py b/tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py new file mode 100644 index 0000000..810c96e --- /dev/null +++ b/tests/roots/test-apidoc-subpackage-in-toc/parent/child/foo.py @@ -0,0 +1 @@ +"foo" diff --git a/tests/roots/test-apidoc-toc/mypackage/__init__.py b/tests/roots/test-apidoc-toc/mypackage/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-apidoc-toc/mypackage/main.py b/tests/roots/test-apidoc-toc/mypackage/main.py new file mode 100755 index 0000000..f532813 --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/main.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import os + +import mod_resource +import mod_something + +if __name__ == "__main__": + print(f"Hello, world! -> something returns: {mod_something.something()}") + + res_path = \ + os.path.join(os.path.dirname(mod_resource.__file__), 'resource.txt') + with open(res_path, encoding='utf-8') as f: + text = f.read() + print(f"From mod_resource:resource.txt -> {text}") diff --git a/tests/roots/test-apidoc-toc/mypackage/no_init/foo.py b/tests/roots/test-apidoc-toc/mypackage/no_init/foo.py new file mode 100644 index 0000000..ece50cb --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/no_init/foo.py @@ -0,0 +1 @@ +MESSAGE = "There's no __init__.py in this folder, hence we should be left out" diff --git a/tests/roots/test-apidoc-toc/mypackage/resource/__init__.py b/tests/roots/test-apidoc-toc/mypackage/resource/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-apidoc-toc/mypackage/resource/resource.txt b/tests/roots/test-apidoc-toc/mypackage/resource/resource.txt new file mode 100644 index 0000000..c04433e --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/resource/resource.txt @@ -0,0 +1 @@ +This is a text resource to be included in this otherwise empty module. No python contents here. diff --git a/tests/roots/test-apidoc-toc/mypackage/something/__init__.py b/tests/roots/test-apidoc-toc/mypackage/something/__init__.py new file mode 100644 index 0000000..6401e43 --- /dev/null +++ b/tests/roots/test-apidoc-toc/mypackage/something/__init__.py @@ -0,0 +1 @@ +"Subpackage Something" diff --git a/tests/roots/test-apidoc-trailing-underscore/package_/__init__.py b/tests/roots/test-apidoc-trailing-underscore/package_/__init__.py new file mode 100644 index 0000000..b09612b --- /dev/null +++ b/tests/roots/test-apidoc-trailing-underscore/package_/__init__.py @@ -0,0 +1 @@ +""" A package with trailing underscores """ diff --git a/tests/roots/test-apidoc-trailing-underscore/package_/module_.py b/tests/roots/test-apidoc-trailing-underscore/package_/module_.py new file mode 100644 index 0000000..e16461c --- /dev/null +++ b/tests/roots/test-apidoc-trailing-underscore/package_/module_.py @@ -0,0 +1,9 @@ +""" A module with a trailing underscore """ + + +class SomeClass_: + """ A class with a trailing underscore """ + + +def some_function_(some_arg_): + """ A function with a trailing underscore in name and argument """ diff --git a/tests/roots/test-autosummary/conf.py b/tests/roots/test-autosummary/conf.py new file mode 100644 index 0000000..46cf4fa --- /dev/null +++ b/tests/roots/test-autosummary/conf.py @@ -0,0 +1,12 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] + +# The suffix of source filenames. +source_suffix = '.rst' +autosummary_generate = True + +exclude_patterns = ['_build'] diff --git a/tests/roots/test-autosummary/dummy_module.py b/tests/roots/test-autosummary/dummy_module.py new file mode 100644 index 0000000..4adc031 --- /dev/null +++ b/tests/roots/test-autosummary/dummy_module.py @@ -0,0 +1,85 @@ +""" +.. autosummary:: + + module_attr + C.class_attr + C.instance_attr + C.prop_attr1 + C.prop_attr2 + C.C2 +""" + + +def withSentence(): + '''I have a sentence which + spans multiple lines. Then I have + more stuff + ''' + pass + + +def noSentence(): + '''this doesn't start with a + capital. so it's not considered + a sentence + ''' + pass + + +def emptyLine(): + '''This is the real summary + + However, it did't end with a period. + ''' + pass + + +#: This is a module attribute +#: +#: value is integer. +module_attr = 1 + + +class C: + ''' + My C class + + with class_attr attribute + ''' + + #: This is a class attribute + #: + #: value is integer. + class_attr = 42 + + def __init__(self): + #: This is an instance attribute + #: + #: value is a string + self.instance_attr = "42" + + def _prop_attr_get(self): + """ + This is a function docstring + + return value is string. + """ + return 'spam egg' + + prop_attr1 = property(_prop_attr_get) + + prop_attr2 = property(_prop_attr_get) + """ + This is a attribute docstring + + value is string. + """ + + class C2: + ''' + This is a nested inner class docstring + ''' + + +def func(arg_, *args, **kwargs): + """Test function take an argument ended with underscore.""" diff --git a/tests/roots/test-autosummary/index.rst b/tests/roots/test-autosummary/index.rst new file mode 100644 index 0000000..5ddc4bd --- /dev/null +++ b/tests/roots/test-autosummary/index.rst @@ -0,0 +1,8 @@ + +.. autosummary:: + :nosignatures: + :toctree: + + dummy_module + underscore_module_ + sphinx diff --git a/tests/roots/test-autosummary/sphinx.rst b/tests/roots/test-autosummary/sphinx.rst new file mode 100644 index 0000000..fc1a35a --- /dev/null +++ b/tests/roots/test-autosummary/sphinx.rst @@ -0,0 +1,31 @@ +Autosummary test +================ + +.. autosummary:: + :toctree: generated + + sphinx.application.Sphinx + +.. currentmodule:: sphinx.application + +.. autoclass:: TemplateBridge + + Basic test + + .. autosummary:: + + render -- some ignored stuff goes here + render_string More ignored stuff + + Test with tildes + + .. autosummary:: + + ~TemplateBridge.render + ~TemplateBridge.render_string + + Methods: + + .. automethod:: render + + .. automethod:: render_string diff --git a/tests/roots/test-autosummary/underscore_module_.py b/tests/roots/test-autosummary/underscore_module_.py new file mode 100644 index 0000000..8584e60 --- /dev/null +++ b/tests/roots/test-autosummary/underscore_module_.py @@ -0,0 +1,15 @@ +""" +module with trailing underscores everywhere +""" + + +class class_: + """ Class """ + def method_(_arg): + """ Method """ + pass + + +def function_(_arg): + """ Function """ + pass diff --git a/tests/roots/test-basic/conf.py b/tests/roots/test-basic/conf.py new file mode 100644 index 0000000..e274bde --- /dev/null +++ b/tests/roots/test-basic/conf.py @@ -0,0 +1,3 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-basic/index.rst b/tests/roots/test-basic/index.rst new file mode 100644 index 0000000..af12ed6 --- /dev/null +++ b/tests/roots/test-basic/index.rst @@ -0,0 +1,31 @@ +The basic Sphinx documentation for testing +========================================== + +Sphinx is a tool that makes it easy to create intelligent and beautiful +documentation for Python projects (or other documents consisting of multiple +reStructuredText sources), written by Georg Brandl. It was originally created +for the new Python documentation, and has excellent facilities for Python +project documentation, but C/C++ is supported as well, and more languages are +planned. + +Sphinx uses reStructuredText as its markup language, and many of its strengths +come from the power and straightforwardness of reStructuredText and its parsing +and translating suite, the Docutils. + +features +-------- + +Among its features are the following: + +* Output formats: HTML (including derivative formats such as HTML Help, Epub + and Qt Help), plain text, manual pages and LaTeX or direct PDF output + using rst2pdf +* Extensive cross-references: semantic markup and automatic links + for functions, classes, glossary terms and similar pieces of information +* Hierarchical structure: easy definition of a document tree, with automatic + links to siblings, parents and children +* Automatic indices: general index as well as a module index +* Code handling: automatic highlighting using the Pygments highlighter +* Flexible HTML output using the Jinja 2 templating engine +* Various extensions are available, e.g. for automatic testing of snippets + and inclusion of appropriately formatted docstrings diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/extra.css b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/extra.css new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/mytheme.css b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/_static/mytheme.css new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/theme.conf b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/theme.conf new file mode 100644 index 0000000..c87296e --- /dev/null +++ b/tests/roots/test-build-html-theme-having-multiple-stylesheets/_themes/mytheme/theme.conf @@ -0,0 +1,3 @@ +[theme] +inherit = basic +stylesheet = mytheme.css, extra.css diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/conf.py b/tests/roots/test-build-html-theme-having-multiple-stylesheets/conf.py new file mode 100644 index 0000000..3cb43d6 --- /dev/null +++ b/tests/roots/test-build-html-theme-having-multiple-stylesheets/conf.py @@ -0,0 +1,2 @@ +html_theme_path = ['_themes'] +html_theme = 'mytheme' diff --git a/tests/roots/test-build-html-theme-having-multiple-stylesheets/index.rst b/tests/roots/test-build-html-theme-having-multiple-stylesheets/index.rst new file mode 100644 index 0000000..b8b81f9 --- /dev/null +++ b/tests/roots/test-build-html-theme-having-multiple-stylesheets/index.rst @@ -0,0 +1,2 @@ +test-build-html-theme-having-multiple-stylesheets +================================================= diff --git a/tests/roots/test-build-html-translator/conf.py b/tests/roots/test-build-html-translator/conf.py new file mode 100644 index 0000000..89448d4 --- /dev/null +++ b/tests/roots/test-build-html-translator/conf.py @@ -0,0 +1,16 @@ +from sphinx.writers.html import HTML5Translator + +project = 'test' + + +class ConfHTMLTranslator(HTML5Translator): + depart_with_node = 0 + + def depart_admonition(self, node=None): + if node is not None: + self.depart_with_node += 1 + HTML5Translator.depart_admonition(self, node) + + +def setup(app): + app.set_translator('html', ConfHTMLTranslator) diff --git a/tests/roots/test-build-html-translator/index.rst b/tests/roots/test-build-html-translator/index.rst new file mode 100644 index 0000000..1610d2b --- /dev/null +++ b/tests/roots/test-build-html-translator/index.rst @@ -0,0 +1,24 @@ +======================= +Test HTML admonitions +======================= + +.. seealso:: test + +.. note:: test + +.. warning:: test + +.. attention:: test + +.. caution:: test + +.. danger:: test + +.. error:: test + +.. hint:: test + +.. important:: test + +.. tip:: test + diff --git a/tests/roots/test-build-text/conf.py b/tests/roots/test-build-text/conf.py new file mode 100644 index 0000000..fd9eefb --- /dev/null +++ b/tests/roots/test-build-text/conf.py @@ -0,0 +1,2 @@ +source_suffix = '.txt' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-build-text/doc1.txt b/tests/roots/test-build-text/doc1.txt new file mode 100644 index 0000000..da1909a --- /dev/null +++ b/tests/roots/test-build-text/doc1.txt @@ -0,0 +1,2 @@ +Section A +========= diff --git a/tests/roots/test-build-text/doc2.txt b/tests/roots/test-build-text/doc2.txt new file mode 100644 index 0000000..ebc88e9 --- /dev/null +++ b/tests/roots/test-build-text/doc2.txt @@ -0,0 +1,9 @@ +Section B +========= + +Sub Ba +------ + +Sub Bb +------ + diff --git a/tests/roots/test-build-text/index.txt b/tests/roots/test-build-text/index.txt new file mode 100644 index 0000000..ca9f8dc --- /dev/null +++ b/tests/roots/test-build-text/index.txt @@ -0,0 +1,11 @@ +.. toctree:: + :numbered: + + doc1 + doc2 + maxwidth + lineblock + nonascii_title + nonascii_table + nonascii_maxwidth + table diff --git a/tests/roots/test-build-text/lineblock.txt b/tests/roots/test-build-text/lineblock.txt new file mode 100644 index 0000000..b9cd0ed --- /dev/null +++ b/tests/roots/test-build-text/lineblock.txt @@ -0,0 +1,6 @@ +* one + + | line-block 1 + | line-block 2 + +followed paragraph. diff --git a/tests/roots/test-build-text/listitems.txt b/tests/roots/test-build-text/listitems.txt new file mode 100644 index 0000000..f0952d8 --- /dev/null +++ b/tests/roots/test-build-text/listitems.txt @@ -0,0 +1,4 @@ +.. seealso:: + + * item 1 + * item 2 diff --git a/tests/roots/test-build-text/maxwidth.txt b/tests/roots/test-build-text/maxwidth.txt new file mode 100644 index 0000000..c36f8a0 --- /dev/null +++ b/tests/roots/test-build-text/maxwidth.txt @@ -0,0 +1,6 @@ +.. seealso:: ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham + +* ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham +* ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham ham + +spam egg diff --git a/tests/roots/test-build-text/nonascii_maxwidth.txt b/tests/roots/test-build-text/nonascii_maxwidth.txt new file mode 100644 index 0000000..e9f0fd9 --- /dev/null +++ b/tests/roots/test-build-text/nonascii_maxwidth.txt @@ -0,0 +1,5 @@ +abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc + +日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 日本語 + +abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 abc 日本語 diff --git a/tests/roots/test-build-text/nonascii_table.txt b/tests/roots/test-build-text/nonascii_table.txt new file mode 100644 index 0000000..709e0f2 --- /dev/null +++ b/tests/roots/test-build-text/nonascii_table.txt @@ -0,0 +1,7 @@ +.. list-table:: + + - - spam + - egg + + - - 日本語 + - 日本語 diff --git a/tests/roots/test-build-text/nonascii_title.txt b/tests/roots/test-build-text/nonascii_title.txt new file mode 100644 index 0000000..6d3b1f6 --- /dev/null +++ b/tests/roots/test-build-text/nonascii_title.txt @@ -0,0 +1,2 @@ +日本語 +====== diff --git a/tests/roots/test-build-text/table.txt b/tests/roots/test-build-text/table.txt new file mode 100644 index 0000000..adc8b37 --- /dev/null +++ b/tests/roots/test-build-text/table.txt @@ -0,0 +1,7 @@ ++-----+-----+ +| XXX | XXX | ++-----+-----+ +| | XXX | ++-----+-----+ +| XXX | | ++-----+-----+ diff --git a/tests/roots/test-build-text/table_colspan.txt b/tests/roots/test-build-text/table_colspan.txt new file mode 100644 index 0000000..4ae6637 --- /dev/null +++ b/tests/roots/test-build-text/table_colspan.txt @@ -0,0 +1,7 @@ ++-----+-----+ +| XXX | XXX | ++-----+-----+ +| | XXX | ++-----+ | +| XXX | | ++-----+-----+ diff --git a/tests/roots/test-build-text/table_colspan_and_rowspan.txt b/tests/roots/test-build-text/table_colspan_and_rowspan.txt new file mode 100644 index 0000000..82d3607 --- /dev/null +++ b/tests/roots/test-build-text/table_colspan_and_rowspan.txt @@ -0,0 +1,7 @@ ++-----------+-----+ +| AAA | BBB | ++-----+-----+ | +| | XXX | | +| +-----+-----+ +| DDD | CCC | ++-----+-----------+ diff --git a/tests/roots/test-build-text/table_colspan_left.txt b/tests/roots/test-build-text/table_colspan_left.txt new file mode 100644 index 0000000..dbfa324 --- /dev/null +++ b/tests/roots/test-build-text/table_colspan_left.txt @@ -0,0 +1,7 @@ ++-----+-----+ +| XXX | XXX | ++-----+-----+ +| | XXX | +| +-----+ +| XXX | | ++-----+-----+ diff --git a/tests/roots/test-build-text/table_rowspan.txt b/tests/roots/test-build-text/table_rowspan.txt new file mode 100644 index 0000000..36c30eb --- /dev/null +++ b/tests/roots/test-build-text/table_rowspan.txt @@ -0,0 +1,7 @@ ++-----+-----+ +| XXXXXXXXX | ++-----+-----+ +| | XXX | ++-----+-----+ +| XXX | | ++-----+-----+ diff --git a/tests/roots/test-builder-dirhtml/bar.rst b/tests/roots/test-builder-dirhtml/bar.rst new file mode 100644 index 0000000..11f287a --- /dev/null +++ b/tests/roots/test-builder-dirhtml/bar.rst @@ -0,0 +1,4 @@ +.. _bar: + +bar +=== diff --git a/tests/roots/test-builder-dirhtml/conf.py b/tests/roots/test-builder-dirhtml/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-builder-dirhtml/foo/foo_1.rst b/tests/roots/test-builder-dirhtml/foo/foo_1.rst new file mode 100644 index 0000000..6db0ea5 --- /dev/null +++ b/tests/roots/test-builder-dirhtml/foo/foo_1.rst @@ -0,0 +1,4 @@ +.. _foo_1: + +foo/foo_1 +========= diff --git a/tests/roots/test-builder-dirhtml/foo/foo_2.rst b/tests/roots/test-builder-dirhtml/foo/foo_2.rst new file mode 100644 index 0000000..fae7f26 --- /dev/null +++ b/tests/roots/test-builder-dirhtml/foo/foo_2.rst @@ -0,0 +1,4 @@ +.. _foo_2: + +foo/foo_2 +========= diff --git a/tests/roots/test-builder-dirhtml/foo/index.rst b/tests/roots/test-builder-dirhtml/foo/index.rst new file mode 100644 index 0000000..92d473c --- /dev/null +++ b/tests/roots/test-builder-dirhtml/foo/index.rst @@ -0,0 +1,9 @@ +.. _foo: + +foo/index +========= + +.. toctree:: + + foo_1 + foo_2 diff --git a/tests/roots/test-builder-dirhtml/index.rst b/tests/roots/test-builder-dirhtml/index.rst new file mode 100644 index 0000000..274e177 --- /dev/null +++ b/tests/roots/test-builder-dirhtml/index.rst @@ -0,0 +1,9 @@ +.. _index: + +index +===== + +.. toctree:: + + foo/index + bar diff --git a/tests/roots/test-builder-gettext-dont-rebuild-mo/bom.rst b/tests/roots/test-builder-gettext-dont-rebuild-mo/bom.rst new file mode 100644 index 0000000..3fea824 --- /dev/null +++ b/tests/roots/test-builder-gettext-dont-rebuild-mo/bom.rst @@ -0,0 +1,5 @@ +File with UTF-8 BOM +=================== + +This file has a UTF-8 "BOM". + diff --git a/tests/roots/test-builder-gettext-dont-rebuild-mo/conf.py b/tests/roots/test-builder-gettext-dont-rebuild-mo/conf.py new file mode 100644 index 0000000..d13f727 --- /dev/null +++ b/tests/roots/test-builder-gettext-dont-rebuild-mo/conf.py @@ -0,0 +1 @@ +language = 'xx' diff --git a/tests/roots/test-builder-gettext-dont-rebuild-mo/index.rst b/tests/roots/test-builder-gettext-dont-rebuild-mo/index.rst new file mode 100644 index 0000000..7ff38c5 --- /dev/null +++ b/tests/roots/test-builder-gettext-dont-rebuild-mo/index.rst @@ -0,0 +1,6 @@ +The basic Sphinx documentation for testing +========================================== + +.. toctree:: + + bom diff --git a/tests/roots/test-builder-gettext-dont-rebuild-mo/xx/LC_MESSAGES/bom.po b/tests/roots/test-builder-gettext-dont-rebuild-mo/xx/LC_MESSAGES/bom.po new file mode 100644 index 0000000..c6025eb --- /dev/null +++ b/tests/roots/test-builder-gettext-dont-rebuild-mo/xx/LC_MESSAGES/bom.po @@ -0,0 +1,12 @@ +#, fuzzy +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "File with UTF-8 BOM" +msgstr "Datei mit UTF-8" + +msgid "This file has a UTF-8 \"BOM\"." +msgstr "This file has umlauts: äöü." diff --git a/tests/roots/test-changes/base.rst b/tests/roots/test-changes/base.rst new file mode 100644 index 0000000..a1b2839 --- /dev/null +++ b/tests/roots/test-changes/base.rst @@ -0,0 +1,20 @@ +Version markup +-------------- + +.. versionadded:: 0.6 + Some funny **stuff**. + +.. versionchanged:: 0.6 + Even more funny stuff. + +.. deprecated:: 0.6 + Boring stuff. + +.. versionadded:: 1.2 + + First paragraph of versionadded. + +.. versionchanged:: 1.2 + First paragraph of versionchanged. + + Second paragraph of versionchanged. diff --git a/tests/roots/test-changes/c-api.rst b/tests/roots/test-changes/c-api.rst new file mode 100644 index 0000000..f0ad413 --- /dev/null +++ b/tests/roots/test-changes/c-api.rst @@ -0,0 +1,24 @@ +.. highlight:: c + + +Memory +====== + +.. c:function:: void* Test_Malloc(size_t n) + + Allocate *n* bytes of memory. + + .. versionchanged:: 0.6 + + Can now be replaced with a different allocator. + +System +------ + +Access to the system allocator. + +.. versionadded:: 0.6 + +.. c:function:: void* Test_SysMalloc(size_t n) + + Allocate *n* bytes of memory using system allocator. diff --git a/tests/roots/test-changes/conf.py b/tests/roots/test-changes/conf.py new file mode 100644 index 0000000..c3b2169 --- /dev/null +++ b/tests/roots/test-changes/conf.py @@ -0,0 +1,4 @@ +project = 'Sphinx ChangesBuilder tests' +copyright = '2007-2023 by the Sphinx team, see AUTHORS' +version = '0.6' +release = '0.6alpha1' diff --git a/tests/roots/test-changes/contents.rst b/tests/roots/test-changes/contents.rst new file mode 100644 index 0000000..ced8026 --- /dev/null +++ b/tests/roots/test-changes/contents.rst @@ -0,0 +1,13 @@ +Index for ChangesBuilder tests +============================== + +Contents: + +.. toctree:: + :maxdepth: 2 + :caption: Table of Contents + :name: mastertoc + + base + c-api + library/utils diff --git a/tests/roots/test-changes/library/utils.rst b/tests/roots/test-changes/library/utils.rst new file mode 100644 index 0000000..8644699 --- /dev/null +++ b/tests/roots/test-changes/library/utils.rst @@ -0,0 +1,25 @@ +:mod:`utils` --- Fake utilities module for tests +================================================ + +.. module:: utils + :synopsis: Utility functions + +-------------- + +The :mod:`utils` module is a pretend python module for changes testing. + + +Classes +------- + +.. class:: Path + + Class for handling paths. + + .. versionadded:: 0.5 + + Innovative new way to handle paths. + + .. deprecated:: 0.6 + + So, that was a bad idea it turns out. diff --git a/tests/roots/test-circular/conf.py b/tests/roots/test-circular/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-circular/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-circular/index.rst b/tests/roots/test-circular/index.rst new file mode 100644 index 0000000..294e674 --- /dev/null +++ b/tests/roots/test-circular/index.rst @@ -0,0 +1,4 @@ +.. toctree:: + + sub + diff --git a/tests/roots/test-circular/sub.rst b/tests/roots/test-circular/sub.rst new file mode 100644 index 0000000..cebfd65 --- /dev/null +++ b/tests/roots/test-circular/sub.rst @@ -0,0 +1,3 @@ +.. toctree:: + + index diff --git a/tests/roots/test-config/conf.py b/tests/roots/test-config/conf.py new file mode 100644 index 0000000..0027d87 --- /dev/null +++ b/tests/roots/test-config/conf.py @@ -0,0 +1,3 @@ +project = 'Sphinx ' +release = '0.6alpha1' +templates_path = ['_templates'] diff --git a/tests/roots/test-copyright-multiline/conf.py b/tests/roots/test-copyright-multiline/conf.py new file mode 100644 index 0000000..a2b7b68 --- /dev/null +++ b/tests/roots/test-copyright-multiline/conf.py @@ -0,0 +1,9 @@ +copyright = ( + '2006', + '2006-2009, Alice', + '2010-2013, Bob', + '2014-2017, Charlie', + '2018-2021, David', + '2022-2025, Eve', +) +html_theme = 'basic' diff --git a/tests/roots/test-copyright-multiline/index.rst b/tests/roots/test-copyright-multiline/index.rst new file mode 100644 index 0000000..aa32ae6 --- /dev/null +++ b/tests/roots/test-copyright-multiline/index.rst @@ -0,0 +1,3 @@ +======================== +test-copyright-multiline +======================== diff --git a/tests/roots/test-correct-year/conf.py b/tests/roots/test-correct-year/conf.py new file mode 100644 index 0000000..814c08b --- /dev/null +++ b/tests/roots/test-correct-year/conf.py @@ -0,0 +1 @@ +copyright = '2006-2009, Author' diff --git a/tests/roots/test-correct-year/index.rst b/tests/roots/test-correct-year/index.rst new file mode 100644 index 0000000..938dfd5 --- /dev/null +++ b/tests/roots/test-correct-year/index.rst @@ -0,0 +1,4 @@ +================= +test-correct-year +================= + diff --git a/tests/roots/test-default_role/conf.py b/tests/roots/test-default_role/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-default_role/foo.rst b/tests/roots/test-default_role/foo.rst new file mode 100644 index 0000000..00e5ae5 --- /dev/null +++ b/tests/roots/test-default_role/foo.rst @@ -0,0 +1,4 @@ +foo.rst +======= + +`OK` button diff --git a/tests/roots/test-default_role/index.rst b/tests/roots/test-default_role/index.rst new file mode 100644 index 0000000..34c1855 --- /dev/null +++ b/tests/roots/test-default_role/index.rst @@ -0,0 +1,6 @@ +default_role +============ + +.. default-role:: pep + +`8` diff --git a/tests/roots/test-directive-code/caption.rst b/tests/roots/test-directive-code/caption.rst new file mode 100644 index 0000000..77c5c38 --- /dev/null +++ b/tests/roots/test-directive-code/caption.rst @@ -0,0 +1,52 @@ +Caption +======= + +References +---------- + +See :numref:`name *test* rb` and :numref:`name **test** py`. + +See :ref:`Ruby ` and :ref:`Python `. + + +Code blocks +----------- + +.. code-block:: ruby + :caption: caption *test* rb + + def ruby? + false + end + + +Literal Include +--------------- + +.. literalinclude:: literal.inc + :language: python + :caption: caption **test** py + :lines: 10-11 + + +Named Code blocks +----------------- + +.. code-block:: ruby + :name: name *test* rb + :caption: caption *test* rbnamed + + def ruby? + false + end + + +Named Literal Include +--------------------- + +.. literalinclude:: literal.inc + :language: python + :name: name **test** py + :caption: caption **test** pynamed + :lines: 10-11 + diff --git a/tests/roots/test-directive-code/classes.rst b/tests/roots/test-directive-code/classes.rst new file mode 100644 index 0000000..e9aa5d9 --- /dev/null +++ b/tests/roots/test-directive-code/classes.rst @@ -0,0 +1,21 @@ +classes +======= + +Code blocks +----------- + +.. code-block:: ruby + :class: foo bar + :name: code_block + + def ruby? + false + end + + +Literal Includes +---------------- + +.. literalinclude:: literal.inc + :class: bar baz + :name: literal_include diff --git a/tests/roots/test-directive-code/conf.py b/tests/roots/test-directive-code/conf.py new file mode 100644 index 0000000..f1e3a2c --- /dev/null +++ b/tests/roots/test-directive-code/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +numfig = True diff --git a/tests/roots/test-directive-code/dedent.rst b/tests/roots/test-directive-code/dedent.rst new file mode 100644 index 0000000..66ac91c --- /dev/null +++ b/tests/roots/test-directive-code/dedent.rst @@ -0,0 +1,64 @@ +dedent option +------------- + +.. code-block:: + + First line + Second line + Third line + Fourth line + +ReST has no fixed indent and only a change in indentation is significant not the amount [1]_. +Thus, the following code inside the code block is not indent even it looks so with respect to the previous block. + +.. code-block:: + + First line + Second line + Third line + Fourth line + +Having an option "fixates" the indent to be 3 spaces, thus the code inside the code block is indented by 4 spaces. + +.. code-block:: + :class: dummy + + First line + Second line + Third line + Fourth line + +The code has 6 spaces indent, minus 4 spaces dedent should yield a 2 space indented code in the output. + +.. code-block:: + :dedent: 4 + + First line + Second line + Third line + Fourth line + +Dedenting by zero, should not strip any spaces and be a no-op. + +.. note:: + This can be used as an alternative to ``:class: dummy`` above, to fixate the ReST indentation of the block. + +.. code-block:: + :dedent: 0 + + First line + Second line + Third line + Fourth line + +Dedent without argument should autostrip common whitespace at the beginning. + +.. code-block:: + :dedent: + + First line + Second line + Third line + Fourth line + +.. [1] https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#indentation diff --git a/tests/roots/test-directive-code/emphasize.rst b/tests/roots/test-directive-code/emphasize.rst new file mode 100644 index 0000000..95db574 --- /dev/null +++ b/tests/roots/test-directive-code/emphasize.rst @@ -0,0 +1,7 @@ +Literal Includes with Highlighted Lines +======================================= + +.. literalinclude:: target.py + :language: python + :emphasize-lines: 5-6, 13-15, 24- + diff --git a/tests/roots/test-directive-code/empty.inc b/tests/roots/test-directive-code/empty.inc new file mode 100644 index 0000000..b28b04f --- /dev/null +++ b/tests/roots/test-directive-code/empty.inc @@ -0,0 +1,3 @@ + + + diff --git a/tests/roots/test-directive-code/error.inc b/tests/roots/test-directive-code/error.inc new file mode 100644 index 0000000..4728280 --- /dev/null +++ b/tests/roots/test-directive-code/error.inc @@ -0,0 +1 @@ +not a python script! diff --git a/tests/roots/test-directive-code/force.rst b/tests/roots/test-directive-code/force.rst new file mode 100644 index 0000000..1834b3a --- /dev/null +++ b/tests/roots/test-directive-code/force.rst @@ -0,0 +1,16 @@ +force option +============ + +.. code:: python + :force: + + not a python script! + +.. code-block:: python + :force: + + not a python script! + +.. literalinclude:: error.inc + :language: python + :force: diff --git a/tests/roots/test-directive-code/highlight.rst b/tests/roots/test-directive-code/highlight.rst new file mode 100644 index 0000000..4191b58 --- /dev/null +++ b/tests/roots/test-directive-code/highlight.rst @@ -0,0 +1,20 @@ +highlight +--------- + +.. code-block:: + + "A code-block without no language" + +.. code-block:: python2 + + "A code-block with language argument" + +.. highlight:: python3 + +.. code-block:: + + "A code-block without no language after highlight directive" + +.. code-block:: python2 + + "A code-block without language argument after highlight directive" diff --git a/tests/roots/test-directive-code/index.rst b/tests/roots/test-directive-code/index.rst new file mode 100644 index 0000000..dab6b70 --- /dev/null +++ b/tests/roots/test-directive-code/index.rst @@ -0,0 +1,25 @@ +test-directive-code +=================== + +.. toctree:: + :glob: + + * + + +Code blocks +----------- + +.. code-block:: ruby + :linenos: + + def ruby? + false + end + + +Literal Includes +---------------- + +.. literalinclude:: literal.inc + :language: python diff --git a/tests/roots/test-directive-code/linenos.rst b/tests/roots/test-directive-code/linenos.rst new file mode 100644 index 0000000..a8e5b69 --- /dev/null +++ b/tests/roots/test-directive-code/linenos.rst @@ -0,0 +1,18 @@ +Literal Includes with Line Numbers +================================== + +.. literalinclude:: literal.inc + :language: python + :linenos: + +.. literalinclude:: literal.inc + :language: python + :lineno-start: 200 + +.. literalinclude:: literal.inc + :language: python + :lines: 5-9 + :lineno-match: + +.. literalinclude:: empty.inc + :lineno-match: diff --git a/tests/roots/test-directive-code/linenothreshold.rst b/tests/roots/test-directive-code/linenothreshold.rst new file mode 100644 index 0000000..09ee67e --- /dev/null +++ b/tests/roots/test-directive-code/linenothreshold.rst @@ -0,0 +1,23 @@ +Code Blocks and Literal Includes with Line Numbers via linenothreshold +====================================================================== + +.. highlight:: python + :linenothreshold: 5 + +.. code-block:: + + class Foo: + pass + + class Bar: + def baz(): + pass + +.. code-block:: + + # comment + value = True + +.. literalinclude:: literal.inc + +.. literalinclude:: literal-short.inc diff --git a/tests/roots/test-directive-code/literal-diff.inc b/tests/roots/test-directive-code/literal-diff.inc new file mode 100644 index 0000000..f9c21e3 --- /dev/null +++ b/tests/roots/test-directive-code/literal-diff.inc @@ -0,0 +1,13 @@ +# Literally included file using Python highlighting + +foo = "Including Unicode characters: üöä" + +class Foo: + pass + +class Bar: + def baz(self): + pass + +# comment after Bar class +def bar(): pass diff --git a/tests/roots/test-directive-code/literal-short.inc b/tests/roots/test-directive-code/literal-short.inc new file mode 100644 index 0000000..7a07a3f --- /dev/null +++ b/tests/roots/test-directive-code/literal-short.inc @@ -0,0 +1,3 @@ +# Very small literal include (linenothreshold check) + +value = True diff --git a/tests/roots/test-directive-code/literal.inc b/tests/roots/test-directive-code/literal.inc new file mode 100644 index 0000000..fa8f0ca --- /dev/null +++ b/tests/roots/test-directive-code/literal.inc @@ -0,0 +1,13 @@ +# Literally included file using Python highlighting + +foo = "Including Unicode characters: üöä" + +class Foo: + pass + +class Bar: + def baz(): + pass + +# comment after Bar class definition +def bar(): pass diff --git a/tests/roots/test-directive-code/namedblocks.rst b/tests/roots/test-directive-code/namedblocks.rst new file mode 100644 index 0000000..5779bc9 --- /dev/null +++ b/tests/roots/test-directive-code/namedblocks.rst @@ -0,0 +1,28 @@ +Named Blocks +============ + +References to named blocks +-------------------------- + +See :ref:`the ruby code ` and +also :ref:`the python code `. + + +Named Code block +---------------- + +.. code-block:: ruby + :name: some ruby code + + def ruby? + false + end + + +Named Literal Include +--------------------- + +.. literalinclude:: literal.inc + :language: python + :name: some python code + diff --git a/tests/roots/test-directive-code/py-decorators.inc b/tests/roots/test-directive-code/py-decorators.inc new file mode 100644 index 0000000..012d5d5 --- /dev/null +++ b/tests/roots/test-directive-code/py-decorators.inc @@ -0,0 +1,15 @@ +# Literally included file using Python highlighting + +@class_decorator +@other_decorator() +class TheClass(object): + + @method_decorator + @other_decorator() + def the_method(): + pass + +@function_decorator +@other_decorator() +def the_function(): + pass diff --git a/tests/roots/test-directive-code/py-decorators.rst b/tests/roots/test-directive-code/py-decorators.rst new file mode 100644 index 0000000..31417f5 --- /dev/null +++ b/tests/roots/test-directive-code/py-decorators.rst @@ -0,0 +1,17 @@ +py-decorators +============= + +Various decorators +------------------ + +.. literalinclude:: py-decorators.inc + :name: literal_include_pydecorators_1 + :pyobject: TheClass + +.. literalinclude:: py-decorators.inc + :name: literal_include_pydecorators_2 + :pyobject: TheClass.the_method + +.. literalinclude:: py-decorators.inc + :name: literal_include_pydecorators_3 + :pyobject: the_function diff --git a/tests/roots/test-directive-code/python.rst b/tests/roots/test-directive-code/python.rst new file mode 100644 index 0000000..794c190 --- /dev/null +++ b/tests/roots/test-directive-code/python.rst @@ -0,0 +1,13 @@ +=========================== +Literal Includes for python +=========================== + +block start with blank or comment +================================= + +.. literalinclude:: target.py + :pyobject: block_start_with_comment + +.. literalinclude:: target.py + :pyobject: block_start_with_blank + diff --git a/tests/roots/test-directive-code/target.py b/tests/roots/test-directive-code/target.py new file mode 100644 index 0000000..b95dffb --- /dev/null +++ b/tests/roots/test-directive-code/target.py @@ -0,0 +1,26 @@ +# Literally included file using Python highlighting + +foo = "Including Unicode characters: üöä" + +class Foo: + pass + +class Bar: + def baz(): + pass + +# comment after Bar class definition +def bar(): pass + +def block_start_with_comment(): + # Comment + return 1 + +def block_start_with_blank(): + + return 1 + + +class Qux: + def quux(self): + pass diff --git a/tests/roots/test-directive-csv-table/conf.py b/tests/roots/test-directive-csv-table/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-directive-csv-table/example.csv b/tests/roots/test-directive-csv-table/example.csv new file mode 100644 index 0000000..eb039aa --- /dev/null +++ b/tests/roots/test-directive-csv-table/example.csv @@ -0,0 +1 @@ +foo,bar,baz diff --git a/tests/roots/test-directive-csv-table/subdir/example.csv b/tests/roots/test-directive-csv-table/subdir/example.csv new file mode 100644 index 0000000..32fe56f --- /dev/null +++ b/tests/roots/test-directive-csv-table/subdir/example.csv @@ -0,0 +1 @@ +FOO,BAR,BAZ diff --git a/tests/roots/test-directive-include/bar.txt b/tests/roots/test-directive-include/bar.txt new file mode 100644 index 0000000..c0fef4c --- /dev/null +++ b/tests/roots/test-directive-include/bar.txt @@ -0,0 +1 @@ +Text from :file:`bar.txt`. diff --git a/tests/roots/test-directive-include/baz/baz.rst b/tests/roots/test-directive-include/baz/baz.rst new file mode 100644 index 0000000..0b74be0 --- /dev/null +++ b/tests/roots/test-directive-include/baz/baz.rst @@ -0,0 +1,6 @@ +Baz +=== + +.. include:: foo.rst + +Baz was here. diff --git a/tests/roots/test-directive-include/conf.py b/tests/roots/test-directive-include/conf.py new file mode 100644 index 0000000..a476858 --- /dev/null +++ b/tests/roots/test-directive-include/conf.py @@ -0,0 +1,2 @@ +project = 'test-directive-include' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-directive-include/foo.rst b/tests/roots/test-directive-include/foo.rst new file mode 100644 index 0000000..0f82e66 --- /dev/null +++ b/tests/roots/test-directive-include/foo.rst @@ -0,0 +1 @@ +The #magical foo. diff --git a/tests/roots/test-directive-include/text.txt b/tests/roots/test-directive-include/text.txt new file mode 100644 index 0000000..b7ea15d --- /dev/null +++ b/tests/roots/test-directive-include/text.txt @@ -0,0 +1 @@ +This is plain text. diff --git a/tests/roots/test-directive-only/conf.py b/tests/roots/test-directive-only/conf.py new file mode 100644 index 0000000..191d0f5 --- /dev/null +++ b/tests/roots/test-directive-only/conf.py @@ -0,0 +1,2 @@ +project = 'test-directive-only' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-directive-only/index.rst b/tests/roots/test-directive-only/index.rst new file mode 100644 index 0000000..80ec003 --- /dev/null +++ b/tests/roots/test-directive-only/index.rst @@ -0,0 +1,6 @@ +test-directive-only +=================== + +.. toctree:: + + only diff --git a/tests/roots/test-directive-only/only.rst b/tests/roots/test-directive-only/only.rst new file mode 100644 index 0000000..4a3eb48 --- /dev/null +++ b/tests/roots/test-directive-only/only.rst @@ -0,0 +1,203 @@ + +1. Sections in only directives +============================== + +Testing sections in only directives. + +.. only:: nonexisting_tag + + Skipped Section + --------------- + Should not be here. + +.. only:: not nonexisting_tag + + 1.1. Section + ------------ + Should be here. + +1.2. Section +------------ + +.. only:: not nonexisting_tag + + 1.2.1. Subsection + ~~~~~~~~~~~~~~~~~ + Should be here. + +.. only:: nonexisting_tag + + Skipped Subsection + ~~~~~~~~~~~~~~~~~~ + Should not be here. + +1.3. Section +------------ + +1.3.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.4. Section +------------ + +.. only:: not nonexisting_tag + + 1.4.1. Subsection + ~~~~~~~~~~~~~~~~~ + Should be here. + +1.5. Section +------------ + +.. only:: not nonexisting_tag + + 1.5.1. Subsection + ~~~~~~~~~~~~~~~~~ + Should be here. + +1.5.2. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.6. Section +------------ + +1.6.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +.. only:: not nonexisting_tag + + 1.6.2. Subsection + ~~~~~~~~~~~~~~~~~ + Should be here. + +1.6.3. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.7. Section +------------ + +1.7.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +.. only:: not nonexisting_tag + + 1.7.1.1. Subsubsection + ...................... + Should be here. + +1.8. Section +------------ + +1.8.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.8.1.1. Subsubsection +...................... +Should be here. + +.. only:: not nonexisting_tag + + 1.8.1.2. Subsubsection + ...................... + Should be here. + +1.9. Section +------------ + +.. only:: nonexisting_tag + + Skipped Subsection + ~~~~~~~~~~~~~~~~~~ + +1.9.1. Subsection +~~~~~~~~~~~~~~~~~ +Should be here. + +1.9.1.1. Subsubsection +...................... +Should be here. + +.. only:: not nonexisting_tag + + 1.10. Section + ------------- + Should be here. + +1.11. Section +------------- + +Text before subsection 11.1. + +.. only:: not nonexisting_tag + + More text before subsection 11.1. + + 1.11.1. Subsection + ~~~~~~~~~~~~~~~~~~ + Should be here. + +Text after subsection 11.1. + +.. only:: not nonexisting_tag + + 1.12. Section + ------------- + Should be here. + + 1.12.1. Subsection + ~~~~~~~~~~~~~~~~~~ + Should be here. + + 1.13. Section + ------------- + Should be here. + +.. only:: not nonexisting_tag + + 1.14. Section + ------------- + Should be here. + + .. only:: not nonexisting_tag + + 1.14.1. Subsection + ~~~~~~~~~~~~~~~~~~ + Should be here. + + 1.15. Section + ------------- + Should be here. + +.. only:: nonexisting_tag + + Skipped document level heading + ============================== + Should not be here. + +.. only:: not nonexisting_tag + + 2. Included document level heading + ================================== + Should be here. + +3. Document level heading +========================= +Should be here. + +.. only:: nonexisting_tag + + Skipped document level heading + ============================== + Should not be here. + +.. only:: not nonexisting_tag + + 4. Another included document level heading + ========================================== + Should be here. diff --git a/tests/roots/test-directives-raw/conf.py b/tests/roots/test-directives-raw/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-directives-raw/index.rst b/tests/roots/test-directives-raw/index.rst new file mode 100644 index 0000000..401ab73 --- /dev/null +++ b/tests/roots/test-directives-raw/index.rst @@ -0,0 +1,40 @@ +test-directives-raw +=================== + +HTML +---- + +standard +^^^^^^^^ + +.. raw:: html + + standalone raw directive (HTML) + +with substitution +^^^^^^^^^^^^^^^^^ + +HTML: abc |HTML_RAW| ghi + +.. |HTML_RAW| raw:: html + + def + +LaTeX +----- + +standard +^^^^^^^^ + +.. raw:: latex + + standalone raw directive (LaTeX) + +with substitution +^^^^^^^^^^^^^^^^^ + +LaTeX: abc |LATEX_RAW| ghi + +.. |LATEX_RAW| raw:: latex + + def diff --git a/tests/roots/test-docutilsconf/conf.py b/tests/roots/test-docutilsconf/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-docutilsconf/docutils.conf b/tests/roots/test-docutilsconf/docutils.conf new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-docutilsconf/index.rst b/tests/roots/test-docutilsconf/index.rst new file mode 100644 index 0000000..d292e32 --- /dev/null +++ b/tests/roots/test-docutilsconf/index.rst @@ -0,0 +1,6 @@ +test-docutilsconf +================== + +Sphinx [1]_ + +.. [1] Python Documentation Generator diff --git a/tests/roots/test-domain-c-c_maximum_signature_line_length/conf.py b/tests/roots/test-domain-c-c_maximum_signature_line_length/conf.py new file mode 100644 index 0000000..ba480ed --- /dev/null +++ b/tests/roots/test-domain-c-c_maximum_signature_line_length/conf.py @@ -0,0 +1 @@ +c_maximum_signature_line_length = len("str hello(str name)") - 1 diff --git a/tests/roots/test-domain-c-c_maximum_signature_line_length/index.rst b/tests/roots/test-domain-c-c_maximum_signature_line_length/index.rst new file mode 100644 index 0000000..be20940 --- /dev/null +++ b/tests/roots/test-domain-c-c_maximum_signature_line_length/index.rst @@ -0,0 +1,4 @@ +domain-c-c_maximum_signature_line_length +======================================== + +.. c:function:: str hello(str name) diff --git a/tests/roots/test-domain-c-intersphinx/conf.py b/tests/roots/test-domain-c-intersphinx/conf.py new file mode 100644 index 0000000..c176af7 --- /dev/null +++ b/tests/roots/test-domain-c-intersphinx/conf.py @@ -0,0 +1,4 @@ +exclude_patterns = ['_build'] +extensions = [ + 'sphinx.ext.intersphinx', +] diff --git a/tests/roots/test-domain-c-intersphinx/index.rst b/tests/roots/test-domain-c-intersphinx/index.rst new file mode 100644 index 0000000..5d6d3e0 --- /dev/null +++ b/tests/roots/test-domain-c-intersphinx/index.rst @@ -0,0 +1,62 @@ +.. c:member:: void __member = _member + + - :any:`_member` + - :c:member:`_member` + - :c:var:`_member` + - :c:data:`_member` + +.. c:member:: void __var = _var + + - :any:`_var` + - :c:member:`_var` + - :c:var:`_var` + - :c:data:`_var` + +.. c:member:: void __function = _function + + - :any:`_function` + - :c:func:`_function` + - :c:type:`_function` + +.. c:member:: void __macro = _macro + + - :any:`_macro` + - :c:macro:`_macro` + +.. c:type:: _struct __struct + struct _struct __structTagged + + - :any:`_struct` + - :c:struct:`_struct` + - :c:type:`_struct` + +.. c:type:: _union __union + union _union __unionTagged + + - :any:`_union` + - :c:union:`_union` + - :c:type:`_union` + +.. c:type:: _enum __enum + enum _enum __enumTagged + + - :any:`_enum` + - :c:enum:`_enum` + - :c:type:`_enum` + +.. c:member:: void __enumerator = _enumerator + + - :any:`_enumerator` + - :c:enumerator:`_enumerator` + +.. c:type:: _type __type + + - :any:`_type` + - :c:type:`_type` + +.. c:member:: void __functionParam = _functionParam.param + + - :any:`_functionParam.param` + - :c:member:`_functionParam.param` + - :c:var:`_functionParam.param` + - :c:data:`_functionParam.param` diff --git a/tests/roots/test-domain-c/anon-dup-decl.rst b/tests/roots/test-domain-c/anon-dup-decl.rst new file mode 100644 index 0000000..743ae2f --- /dev/null +++ b/tests/roots/test-domain-c/anon-dup-decl.rst @@ -0,0 +1,7 @@ +.. c:namespace:: anon_dup_decl_ns + +.. c:struct:: anon_dup_decl + + .. c:struct:: @a.A + .. c:struct:: @b.A + .. c:struct:: A diff --git a/tests/roots/test-domain-c/conf.py b/tests/roots/test-domain-c/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-domain-c/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-domain-c/field-role.rst b/tests/roots/test-domain-c/field-role.rst new file mode 100644 index 0000000..5452db5 --- /dev/null +++ b/tests/roots/test-domain-c/field-role.rst @@ -0,0 +1,4 @@ +.. c:function:: void f(int a, int *b) + + :param int a: + :param int* b: diff --git a/tests/roots/test-domain-c/function_param_target.rst b/tests/roots/test-domain-c/function_param_target.rst new file mode 100644 index 0000000..d316d7b --- /dev/null +++ b/tests/roots/test-domain-c/function_param_target.rst @@ -0,0 +1,7 @@ +.. c:namespace:: function_param_target + +.. c:function:: void f(int i) + + - :c:var:`i` + +- :c:var:`f.i` diff --git a/tests/roots/test-domain-c/index.rst b/tests/roots/test-domain-c/index.rst new file mode 100644 index 0000000..4febd63 --- /dev/null +++ b/tests/roots/test-domain-c/index.rst @@ -0,0 +1,54 @@ +.. c:namespace:: index + +test-domain-c +============= + +directives +---------- + +.. c:function:: int hello(const char *name) + + :rtype: int + +.. c:function:: MyStruct hello2(char *name) + + :rtype: MyStruct + +.. c:member:: float Sphinx.version +.. c:var:: int version + +.. c:macro:: IS_SPHINX +.. c:macro:: SPHINX(arg1, arg2) + +.. c:struct:: MyStruct +.. c:union:: MyUnion +.. c:enum:: MyEnum + + .. c:enumerator:: MyEnumerator + + :c:enumerator:`MyEnumerator` + + :c:enumerator:`MyEnumerator` + +:c:enumerator:`MyEnumerator` + +.. c:type:: Sphinx +.. c:type:: int SphinxVersionNum + + +.. c:struct:: A + + .. c:union:: @data + + .. c:member:: int a + +- :c:member:`A.@data.a` +- :c:member:`A.a` + +- :c:expr:`unsigned int` +- :c:texpr:`unsigned int` + +.. c:var:: A a + +- :c:expr:`a->b` +- :c:texpr:`a->b` diff --git a/tests/roots/test-domain-c/namespace.rst b/tests/roots/test-domain-c/namespace.rst new file mode 100644 index 0000000..c220d38 --- /dev/null +++ b/tests/roots/test-domain-c/namespace.rst @@ -0,0 +1,21 @@ +.. c:namespace:: NS + +.. c:var:: int NSVar + +.. c:namespace:: NULL + +.. c:var:: int NULLVar + +.. c:namespace:: NSDummy + +.. c:namespace:: 0 + +.. c:var:: int ZeroVar + +.. c:namespace-push:: NS2.NS3 + +.. c:var:: int NS2NS3Var + +.. c:namespace-pop:: + +.. c:var:: int PopVar diff --git a/tests/roots/test-domain-c/ns_lookup.rst b/tests/roots/test-domain-c/ns_lookup.rst new file mode 100644 index 0000000..87f9d68 --- /dev/null +++ b/tests/roots/test-domain-c/ns_lookup.rst @@ -0,0 +1,13 @@ +.. c:namespace:: ns_lookup + +.. c:var:: int i + +.. c:function:: void f(int j) + + - :c:var:`i` + - :c:var:`j` + - :c:expr:`i` + - :c:expr:`j` + +- :c:var:`i` +- :c:expr:`i` diff --git a/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/conf.py b/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/conf.py new file mode 100644 index 0000000..1eb3a64 --- /dev/null +++ b/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/conf.py @@ -0,0 +1 @@ +cpp_maximum_signature_line_length = len("str hello(str name)") - 1 diff --git a/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/index.rst b/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/index.rst new file mode 100644 index 0000000..425908c --- /dev/null +++ b/tests/roots/test-domain-cpp-cpp_maximum_signature_line_length/index.rst @@ -0,0 +1,4 @@ +domain-cpp-cpp_maximum_signature_line_length +============================================ + +.. cpp:function:: str hello(str name) diff --git a/tests/roots/test-domain-cpp-intersphinx/conf.py b/tests/roots/test-domain-cpp-intersphinx/conf.py new file mode 100644 index 0000000..c176af7 --- /dev/null +++ b/tests/roots/test-domain-cpp-intersphinx/conf.py @@ -0,0 +1,4 @@ +exclude_patterns = ['_build'] +extensions = [ + 'sphinx.ext.intersphinx', +] diff --git a/tests/roots/test-domain-cpp-intersphinx/index.rst b/tests/roots/test-domain-cpp-intersphinx/index.rst new file mode 100644 index 0000000..9ed9493 --- /dev/null +++ b/tests/roots/test-domain-cpp-intersphinx/index.rst @@ -0,0 +1,112 @@ +.. cpp:type:: _class __class + + - :any:`_class` + - :cpp:any:`_class` + - :cpp:class:`_class` + - :cpp:struct:`_class` + - :cpp:type:`_class` + +.. cpp:type:: _struct __struct + + - :any:`_struct` + - :cpp:any:`_struct` + - :cpp:class:`_struct` + - :cpp:struct:`_struct` + - :cpp:type:`_struct` + +.. cpp:type:: _union __union + + - :any:`_union` + - :cpp:any:`_union` + - :cpp:union:`_union` + - :cpp:type:`_union` + +.. cpp:member:: void __function = _function + + - :any:`_function` + - :cpp:any:`_function` + - :cpp:func:`_function` + - :cpp:type:`_function` + +.. cpp:member:: void __member = _member + + - :any:`_member` + - :cpp:any:`_member` + - :cpp:member:`_member` + - :cpp:var:`_member` + +.. cpp:member:: void __var = _var + + - :any:`_var` + - :cpp:any:`_var` + - :cpp:member:`_var` + - :cpp:var:`_var` + +.. cpp:type:: _type __type + + - :any:`_type` + - :cpp:any:`_type` + - :cpp:type:`_type` + +.. cpp:function:: template<_concept T> void __concept() + + - :any:`_concept` + - :cpp:any:`_concept` + - :cpp:concept:`_concept` + +.. cpp:type:: _enum __enum + + - :any:`_enum` + - :cpp:any:`_enum` + - :cpp:enum:`_enum` + - :cpp:type:`_enum` + +.. cpp:type:: _enumStruct __enumStruct + + - :any:`_enumStruct` + - :cpp:any:`_enumStruct` + - :cpp:enum:`_enumStruct` + - :cpp:type:`_enumStruct` + +.. cpp:type:: _enumClass __enumClass + + - :any:`_enumClass` + - :cpp:any:`_enumClass` + - :cpp:enum:`_enumClass` + - :cpp:type:`_enumClass` + +.. cpp:member:: void __enumerator = _enumerator + + - :any:`_enumerator` + - :cpp:any:`_enumerator` + - :cpp:enumerator:`_enumerator` + +.. cpp:member:: void __scopedEnumerator = _enumStruct::_scopedEnumerator + + - :any:`_enumStruct::_scopedEnumerator` + - :cpp:any:`_enumStruct::_scopedEnumerator` + - :cpp:enumerator:`_enumStruct::_scopedEnumerator` + +.. cpp:member:: void __enumerator2 = _enum::_enumerator + + - :any:`_enum::_enumerator` + - :cpp:any:`_enum::_enumerator` + - :cpp:enumerator:`_enum::_enumerator` + +.. cpp:member:: void __functionParam = _functionParam::param + + - :any:`_functionParam::param` + - :cpp:any:`_functionParam::param` + - :cpp:member:`_functionParam::param` + - :cpp:var:`_functionParam::param` + +.. cpp:type:: _templateParam::TParam __templateParam + + - :any:`_templateParam::TParam` + - :cpp:any:`_templateParam::TParam` + - :cpp:type:`_templateParam::TParam` + - :cpp:member:`_templateParam::TParam` + - :cpp:var:`_templateParam::TParam` + - :cpp:class:`_templateParam::TParam` + - :cpp:struct:`_templateParam::TParam` + - :cpp:union:`_templateParam::TParam` diff --git a/tests/roots/test-domain-cpp/anon-dup-decl.rst b/tests/roots/test-domain-cpp/anon-dup-decl.rst new file mode 100644 index 0000000..89a9c95 --- /dev/null +++ b/tests/roots/test-domain-cpp/anon-dup-decl.rst @@ -0,0 +1,4 @@ +.. cpp:namespace:: anon_dup_decl +.. cpp:class:: @a::A +.. cpp:class:: @b::A +.. cpp:class:: A diff --git a/tests/roots/test-domain-cpp/any-role.rst b/tests/roots/test-domain-cpp/any-role.rst new file mode 100644 index 0000000..24b415e --- /dev/null +++ b/tests/roots/test-domain-cpp/any-role.rst @@ -0,0 +1,17 @@ +any role +-------- + +* :cpp:any:`Sphinx` +* :cpp:any:`Sphinx::version` +* :cpp:any:`version` +* :cpp:any:`List` +* :cpp:any:`MyEnum` + +* ref function without parens :cpp:any:`paren_1` +* ref function with parens :cpp:any:`paren_2()` +* ref function without parens, explicit title :cpp:any:`paren_3_title ` +* ref function with parens, explicit title :cpp:any:`paren_4_title ` +* ref op call without parens :cpp:any:`paren_5::operator()` +* ref op call with parens :cpp:any:`paren_6::operator()()` +* ref op call without parens, explicit title :cpp:any:`paren_7_title ` +* ref op call with parens, explicit title :cpp:any:`paren_8_title ` diff --git a/tests/roots/test-domain-cpp/backslash.rst b/tests/roots/test-domain-cpp/backslash.rst new file mode 100644 index 0000000..c93e68e --- /dev/null +++ b/tests/roots/test-domain-cpp/backslash.rst @@ -0,0 +1 @@ +.. cpp:var:: char c = '\\' diff --git a/tests/roots/test-domain-cpp/conf.py b/tests/roots/test-domain-cpp/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-domain-cpp/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-domain-cpp/field-role.rst b/tests/roots/test-domain-cpp/field-role.rst new file mode 100644 index 0000000..1711a88 --- /dev/null +++ b/tests/roots/test-domain-cpp/field-role.rst @@ -0,0 +1,5 @@ +.. cpp:function:: void f() + + :throws int: + :throws int*: + diff --git a/tests/roots/test-domain-cpp/index.rst b/tests/roots/test-domain-cpp/index.rst new file mode 100644 index 0000000..2df5ec8 --- /dev/null +++ b/tests/roots/test-domain-cpp/index.rst @@ -0,0 +1,53 @@ +test-domain-cpp +=============== + +directives +---------- + +.. cpp:class:: public Sphinx + + The description of Sphinx class. + +.. cpp:function:: int hello(char *name) + + The description of hello function. + +.. cpp:member:: float Sphinx::version + + The description of Sphinx::version. + +.. cpp:var:: int version + + The description of version. + +.. cpp:type:: std::vector List + + The description of List type. + +.. cpp:enum:: MyEnum + + An unscoped enum. + + .. cpp:enumerator:: A + +.. cpp:enum-class:: MyScopedEnum + + A scoped enum. + + .. cpp:enumerator:: B + +.. cpp:enum-struct:: protected MyScopedVisibilityEnum : std::underlying_type::type + + A scoped enum with non-default visibility, and with a specified underlying type. + + .. cpp:enumerator:: B + + +.. cpp:function:: void paren_1(int, float) +.. cpp:function:: void paren_2(int, float) +.. cpp:function:: void paren_3(int, float) +.. cpp:function:: void paren_4(int, float) +.. cpp:function:: void paren_5::operator()(int) +.. cpp:function:: void paren_6::operator()(int) +.. cpp:function:: void paren_7::operator()(int) +.. cpp:function:: void paren_8::operator()(int) diff --git a/tests/roots/test-domain-cpp/lookup-key-overload.rst b/tests/roots/test-domain-cpp/lookup-key-overload.rst new file mode 100644 index 0000000..2011e26 --- /dev/null +++ b/tests/roots/test-domain-cpp/lookup-key-overload.rst @@ -0,0 +1,8 @@ +.. default-domain:: cpp + +.. namespace:: lookup_key_overload + +.. function:: void g(int a) +.. function:: void g(double b) + + :var:`b` diff --git a/tests/roots/test-domain-cpp/multi-decl-lookup.rst b/tests/roots/test-domain-cpp/multi-decl-lookup.rst new file mode 100644 index 0000000..9706d18 --- /dev/null +++ b/tests/roots/test-domain-cpp/multi-decl-lookup.rst @@ -0,0 +1,24 @@ +.. default-domain:: cpp + +.. namespace:: multi_decl_lookup + +.. function:: void f1(int a) + void f1(double b) + + - a: :var:`a` + - b: :var:`b` + +.. function:: template void f2(int a) + template void f2(double b) + + - T: :type:`T` + - U: :type:`U` + + +.. class:: template A + template B + + .. function:: void f3() + + - T: :type:`T` + - U: :type:`U` diff --git a/tests/roots/test-domain-cpp/roles-targets-ok.rst b/tests/roots/test-domain-cpp/roles-targets-ok.rst new file mode 100644 index 0000000..783f7b9 --- /dev/null +++ b/tests/roots/test-domain-cpp/roles-targets-ok.rst @@ -0,0 +1,170 @@ +.. default-domain:: cpp + +.. namespace:: RolesTargetsOk + +.. class:: Class + + :cpp:any:`Class` + :class:`Class` + :struct:`Class` + union + func + member + var + :type:`Class` + concept + enum + enumerator + +.. union:: Union + + :cpp:any:`Union` + class + struct + :union:`Union` + func + member + var + :type:`Union` + concept + enum + enumerator + +.. function:: void Function() + + :cpp:any:`Function` + class + struct + union + :func:`Function` + member + var + :type:`Function` + concept + enum + enumerator + +.. var:: int Variable + + :cpp:any:`Variable` + class + struct + union + function + :member:`Variable` + :var:`Variables` + type + concept + enum + enumerator + +.. type:: Type = void + + :cpp:any:`Type` + class + struct + union + function + member + var + :type:`Type` + concept + enum + enumerator + +.. concept:: template Concept + + :cpp:any:`Concept` + class + struct + union + function + member + var + type + :concept:`Concept` + enum + enumerator + +.. enum-struct:: Enum + + :cpp:any:`Enum` + class + struct + union + function + member + var + :type:`Enum` + concept + :enum:`Enum` + enumerator + + .. enumerator:: Enumerator + + :cpp:any:`Enumerator` + class + struct + union + function + member + var + type + concept + enum + :enumerator:`Enumerator` + +.. class:: template typename TParamTemplate \ + > ClassTemplate + + :cpp:any:`TParamType` + :class:`TParamType` + :struct:`TParamType` + :union:`TParamType` + function + :member:`TParamType` + :var:`TParamType` + :type:`TParamType` + concept + enum + enumerator + + :cpp:any:`TParamVar` + :class:`TParamVar` + :struct:`TParamVar` + :union:`TParamVar` + function + :member:`TParamVar` + :var:`TParamVar` + :type:`TParamVar` + concept + enum + enumerator + + :cpp:any:`TParamTemplate` + :class:`TParamTemplate` + :struct:`TParamTemplate` + :union:`TParamTemplate` + function + :member:`TParamTemplate` + :var:`TParamTemplate` + :type:`TParamTemplate` + concept + enum + enumerator + +.. function:: void FunctionParams(int FunctionParam) + + :cpp:any:`FunctionParam` + class + struct + union + function + :member:`FunctionParam` + :var:`FunctionParam` + type + concept + enum + enumerator diff --git a/tests/roots/test-domain-cpp/roles-targets-warn.rst b/tests/roots/test-domain-cpp/roles-targets-warn.rst new file mode 100644 index 0000000..57083ff --- /dev/null +++ b/tests/roots/test-domain-cpp/roles-targets-warn.rst @@ -0,0 +1,158 @@ +.. default-domain:: cpp + +.. namespace:: RolesTargetsWarn + +.. class:: Class + + class + struct + :union:`Class` + :func:`Class` + :member:`Class` + :var:`Class` + type + :concept:`Class` + :enum:`Class` + :enumerator:`Class` + +.. union:: Union + + :class:`Union` + :struct:`Union` + union + :func:`Union` + :member:`Union` + :var:`Union` + type + :concept:`Union` + :enum:`Union` + :enumerator:`Union` + +.. function:: void Function() + + :class:`Function` + :struct:`Function` + :union:`Function` + func + :member:`Function` + :var:`Function` + type + :concept:`Function` + :enum:`Function` + :enumerator:`Function` + +.. var:: int Variable + + :class:`Variable` + :struct:`Variable` + :union:`Variable` + :func:`Variable` + member + var + :type:`Variable` + :concept:`Variable` + :enum:`Variable` + :enumerator:`Variable` + +.. type:: Type = void + + :class:`Type` + :struct:`Type` + :union:`Type` + :func:`Type` + :member:`Type` + :var:`Type` + type + :concept:`Type` + :enum:`Type` + :enumerator:`Type` + +.. concept:: template Concept + + :class:`Concept` + :struct:`Concept` + :union:`Concept` + :func:`Concept` + :member:`Concept` + :var:`Concept` + :type:`Concept` + concept + :enum:`Concept` + :enumerator:`Concept` + +.. enum-struct:: Enum + + :class:`Enum` + :struct:`Enum` + :union:`Enum` + :func:`Enum` + :member:`Enum` + :var:`Enum` + type + :concept:`Enum` + enum + :enumerator:`Enum` + + .. enumerator:: Enumerator + + :class:`Enumerator` + :struct:`Enumerator` + :union:`Enumerator` + :func:`Enumerator` + :member:`Enumerator` + :var:`Enumerator` + :type:`Enumerator` + :concept:`Enumerator` + :enum:`Enumerator` + enumerator + +.. class:: template typename TParamTemplate \ + > ClassTemplate + + class + struct + union + :func:`TParamType` + member + var + type + :concept:`TParamType` + :enum:`TParamType` + :enumerator:`TParamType` + + class + struct + union + :func:`TParamVar` + member + var + type + :concept:`TParamVar` + :enum:`TParamVar` + :enumerator:`TParamVar` + + class + struct + union + :func:`TParamTemplate` + member + var + type + :concept:`TParamTemplate` + :enum:`TParamTemplate` + :enumerator:`TParamTemplate` + +.. function:: void FunctionParams(int FunctionParam) + + :class:`FunctionParam` + :struct:`FunctionParam` + :union:`FunctionParam` + :func:`FunctionParam` + member + var + :type:`FunctionParam` + :concept:`FunctionParam` + :enum:`FunctionParam` + :enumerator:`FunctionParam` diff --git a/tests/roots/test-domain-cpp/roles.rst b/tests/roots/test-domain-cpp/roles.rst new file mode 100644 index 0000000..afd2ede --- /dev/null +++ b/tests/roots/test-domain-cpp/roles.rst @@ -0,0 +1,17 @@ +roles +----- + +* :cpp:class:`Sphinx` +* :cpp:member:`Sphinx::version` +* :cpp:var:`version` +* :cpp:type:`List` +* :cpp:enum:`MyEnum` + +* ref function without parens :cpp:func:`paren_1` +* ref function with parens :cpp:func:`paren_2()` +* ref function without parens, explicit title :cpp:func:`paren_3_title ` +* ref function with parens, explicit title :cpp:func:`paren_4_title ` +* ref op call without parens :cpp:func:`paren_5::operator()` +* ref op call with parens :cpp:func:`paren_6::operator()()` +* ref op call without parens, explicit title :cpp:func:`paren_7_title ` +* ref op call with parens, explicit title :cpp:func:`paren_8_title ` diff --git a/tests/roots/test-domain-cpp/roles2.rst b/tests/roots/test-domain-cpp/roles2.rst new file mode 100644 index 0000000..644b827 --- /dev/null +++ b/tests/roots/test-domain-cpp/roles2.rst @@ -0,0 +1,5 @@ +Check that we don't crash just because we misuse a role. + +.. cpp:class:: A + +:cpp:func:`A` diff --git a/tests/roots/test-domain-cpp/semicolon.rst b/tests/roots/test-domain-cpp/semicolon.rst new file mode 100644 index 0000000..e6b370e --- /dev/null +++ b/tests/roots/test-domain-cpp/semicolon.rst @@ -0,0 +1,14 @@ +.. cpp:class:: Class; +.. cpp:struct:: Struct; +.. cpp:union:: Union; +.. cpp:function:: void f(); +.. cpp:member:: int member; +.. cpp:var:: int var; +.. cpp:type:: Type; +.. cpp:type:: int TypeDef; +.. cpp:type:: Alias = int; +.. cpp:concept:: template Concept; +.. cpp:enum:: Enum; +.. cpp:enum-struct:: EnumStruct; +.. cpp:enum-class:: EnumClass; +.. cpp:enumerator:: Enumerator; diff --git a/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst b/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst new file mode 100644 index 0000000..49a650d --- /dev/null +++ b/tests/roots/test-domain-cpp/warn-template-param-qualified-name.rst @@ -0,0 +1,11 @@ +.. default-domain:: cpp + +.. class:: template A + + .. type:: N1 = T::typeOk + + - Not ok, warn: :type:`T::typeWarn` + + .. type:: N2 = T::U::typeOk + + - Not ok, warn: :type:`T::U::typeWarn` diff --git a/tests/roots/test-domain-cpp/xref_consistency.rst b/tests/roots/test-domain-cpp/xref_consistency.rst new file mode 100644 index 0000000..cb33000 --- /dev/null +++ b/tests/roots/test-domain-cpp/xref_consistency.rst @@ -0,0 +1,12 @@ +xref consistency +---------------- + +.. cpp:namespace:: xref_consistency + +.. cpp:class:: item + +code-role: :code:`item` +any-role: :any:`item` +cpp-any-role: :cpp:any:`item` +cpp-expr-role: :cpp:expr:`item` +cpp-texpr-role: :cpp:texpr:`item` diff --git a/tests/roots/test-domain-js-javascript_maximum_signature_line_length/conf.py b/tests/roots/test-domain-js-javascript_maximum_signature_line_length/conf.py new file mode 100644 index 0000000..d7c9331 --- /dev/null +++ b/tests/roots/test-domain-js-javascript_maximum_signature_line_length/conf.py @@ -0,0 +1 @@ +javascript_maximum_signature_line_length = 1 diff --git a/tests/roots/test-domain-js-javascript_maximum_signature_line_length/index.rst b/tests/roots/test-domain-js-javascript_maximum_signature_line_length/index.rst new file mode 100644 index 0000000..b79fc1a --- /dev/null +++ b/tests/roots/test-domain-js-javascript_maximum_signature_line_length/index.rst @@ -0,0 +1,6 @@ +domain-js-maximum_signature_line_length +======================================= + +.. js:function:: hello(name) + +.. js:function:: foo([a, [b, ]]c, d[, e, f]) diff --git a/tests/roots/test-domain-js/conf.py b/tests/roots/test-domain-js/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-domain-js/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-domain-js/index.rst b/tests/roots/test-domain-js/index.rst new file mode 100644 index 0000000..fb6b8c3 --- /dev/null +++ b/tests/roots/test-domain-js/index.rst @@ -0,0 +1,7 @@ +test-domain-js +============== + +.. toctree:: + + roles + module diff --git a/tests/roots/test-domain-js/module.rst b/tests/roots/test-domain-js/module.rst new file mode 100644 index 0000000..1fe6a21 --- /dev/null +++ b/tests/roots/test-domain-js/module.rst @@ -0,0 +1,27 @@ +module +======= + +.. js:module:: module_a.submodule + +* Link to :js:class:`ModTopLevel` + +.. js:class:: ModTopLevel + + * Link to :js:meth:`mod_child_1` + * Link to :js:meth:`ModTopLevel.mod_child_1` + +.. js:method:: ModTopLevel.mod_child_1 + + * Link to :js:meth:`mod_child_2` + +.. js:method:: ModTopLevel.mod_child_2 + + * Link to :js:meth:`module_a.submodule.ModTopLevel.mod_child_1` + +.. js:module:: module_b.submodule + +* Link to :js:class:`ModTopLevel` + +.. js:class:: ModTopLevel + + * Link to :js:mod:`module_a.submodule` diff --git a/tests/roots/test-domain-js/roles.rst b/tests/roots/test-domain-js/roles.rst new file mode 100644 index 0000000..4b6acf1 --- /dev/null +++ b/tests/roots/test-domain-js/roles.rst @@ -0,0 +1,48 @@ +roles +===== + +.. js:class:: TopLevel + +.. js:function:: top_level + +* :js:class:`TopLevel` +* :js:func:`top_level` + + +.. js:class:: NestedParentA + + * Link to :js:func:`child_1` + + .. js:function:: child_1() + + * Link to :js:func:`NestedChildA.subchild_2` + * Link to :js:func:`child_2` + * Link to :any:`any_child` + + .. js:function:: any_child() + + * Link to :js:class:`NestedChildA` + + .. js:class:: NestedChildA + + .. js:function:: subchild_1() + + * Link to :js:func:`subchild_2` + + .. js:function:: subchild_2() + + Link to :js:func:`NestedParentA.child_1` + + .. js:function:: child_2() + + Link to :js:func:`NestedChildA.subchild_1` + +.. js:class:: NestedParentB + + * Link to :js:func:`child_1` + + .. js:function:: child_1() + + * Link to :js:class:`NestedParentB` + +* :js:class:`NestedParentA.NestedChildA` diff --git a/tests/roots/test-domain-py-python_maximum_signature_line_length/conf.py b/tests/roots/test-domain-py-python_maximum_signature_line_length/conf.py new file mode 100644 index 0000000..45f620d --- /dev/null +++ b/tests/roots/test-domain-py-python_maximum_signature_line_length/conf.py @@ -0,0 +1 @@ +python_maximum_signature_line_length = 1 diff --git a/tests/roots/test-domain-py-python_maximum_signature_line_length/index.rst b/tests/roots/test-domain-py-python_maximum_signature_line_length/index.rst new file mode 100644 index 0000000..75e4683 --- /dev/null +++ b/tests/roots/test-domain-py-python_maximum_signature_line_length/index.rst @@ -0,0 +1,6 @@ +domain-py-maximum_signature_line_length +======================================= + +.. py:function:: hello(name: str) -> str + +.. py:function:: foo([a, [b, ]]c, d[, e, f]) diff --git a/tests/roots/test-domain-py-python_use_unqualified_type_names/conf.py b/tests/roots/test-domain-py-python_use_unqualified_type_names/conf.py new file mode 100644 index 0000000..c81bfe4 --- /dev/null +++ b/tests/roots/test-domain-py-python_use_unqualified_type_names/conf.py @@ -0,0 +1 @@ +python_use_unqualified_type_names = True diff --git a/tests/roots/test-domain-py-python_use_unqualified_type_names/index.rst b/tests/roots/test-domain-py-python_use_unqualified_type_names/index.rst new file mode 100644 index 0000000..a6850a0 --- /dev/null +++ b/tests/roots/test-domain-py-python_use_unqualified_type_names/index.rst @@ -0,0 +1,12 @@ +domain-py-smart_reference +========================= + +.. py:class:: Name + :module: foo + + :param name: blah blah + :type name: foo.Name + :param age: blah blah + :type age: foo.Age + +.. py:function:: hello(name: foo.Name, age: foo.Age) diff --git a/tests/roots/test-domain-py-xref-warning/conf.py b/tests/roots/test-domain-py-xref-warning/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-domain-py-xref-warning/index.rst b/tests/roots/test-domain-py-xref-warning/index.rst new file mode 100644 index 0000000..6f2cab7 --- /dev/null +++ b/tests/roots/test-domain-py-xref-warning/index.rst @@ -0,0 +1,7 @@ +test-domain-py-xref-warning +=========================== + +.. _existing-label: + +:ref:`no-label` +:ref:`existing-label` diff --git a/tests/roots/test-domain-py/abbr.rst b/tests/roots/test-domain-py/abbr.rst new file mode 100644 index 0000000..67f1157 --- /dev/null +++ b/tests/roots/test-domain-py/abbr.rst @@ -0,0 +1,10 @@ +abbrev +====== + +.. currentmodule:: module_a.submodule + +* normal: :py:meth:`module_a.submodule.ModTopLevel.mod_child_1` +* relative: :py:meth:`.ModTopLevel.mod_child_1` +* short name: :py:meth:`~module_a.submodule.ModTopLevel.mod_child_1` +* relative + short name: :py:meth:`~.ModTopLevel.mod_child_1` +* short name + relative: :py:meth:`~.ModTopLevel.mod_child_1` diff --git a/tests/roots/test-domain-py/canonical.rst b/tests/roots/test-domain-py/canonical.rst new file mode 100644 index 0000000..34becfd --- /dev/null +++ b/tests/roots/test-domain-py/canonical.rst @@ -0,0 +1,12 @@ +caninical +========= + +:py:class:`.Foo` +:any:`Foo` +:any:`module.Foo` +:any:`original.module.Foo` + +.. py:module:: canonical + +.. py:class:: Foo + :canonical: original.module.Foo diff --git a/tests/roots/test-domain-py/conf.py b/tests/roots/test-domain-py/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-domain-py/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-domain-py/index.rst b/tests/roots/test-domain-py/index.rst new file mode 100644 index 0000000..b24bbea --- /dev/null +++ b/tests/roots/test-domain-py/index.rst @@ -0,0 +1,10 @@ +test-domain-py +============== + +.. toctree:: + + roles + module + module_option + abbr + canonical diff --git a/tests/roots/test-domain-py/module.rst b/tests/roots/test-domain-py/module.rst new file mode 100644 index 0000000..4a28068 --- /dev/null +++ b/tests/roots/test-domain-py/module.rst @@ -0,0 +1,60 @@ +module +====== + +.. py:module:: module_a.submodule + +* Link to :py:class:`ModTopLevel` + +.. py:class:: ModTopLevel + + * Link to :py:meth:`mod_child_1` + * Link to :py:meth:`ModTopLevel.mod_child_1` + +.. py:method:: ModTopLevel.mod_child_1 + + * Link to :py:meth:`mod_child_2` + +.. py:method:: ModTopLevel.mod_child_2 + + * Link to :py:meth:`module_a.submodule.ModTopLevel.mod_child_1` + +.. py:property:: ModTopLevel.prop + + * Link to :py:attr:`prop attribute <.prop>` + * Link to :py:meth:`prop method <.prop>` + +.. py:currentmodule:: None + +.. py:class:: ModNoModule + +.. py:module:: module_b.submodule + +* Link to :py:class:`ModTopLevel` + +.. py:class:: ModTopLevel + + * Link to :py:class:`ModNoModule` + +.. py:function:: foo(x, y) + + :param x: param x + :type x: int + :param y: param y + :type y: tuple(str, float) + :rtype: list + +.. py:attribute:: attr1 + + :type: ModTopLevel + +.. py:attribute:: attr2 + + :type: :doc:`index` + +.. py:module:: exceptions + +.. py:exception:: Exception + +.. py:module:: object + +.. py:function:: sum() diff --git a/tests/roots/test-domain-py/module_option.rst b/tests/roots/test-domain-py/module_option.rst new file mode 100644 index 0000000..1dec2ce --- /dev/null +++ b/tests/roots/test-domain-py/module_option.rst @@ -0,0 +1,25 @@ +module_option +============= + +.. py:class:: B + :module: test.extra + + This is also a test. + + + .. py:method:: B.baz() + :module: test.extra + + Does something similar to :meth:`foo`. + + + .. py:method:: B.foo() + :module: test.extra + + Does something. + + + .. py:method:: B.test() + :module: test.extra + + Does something completely unrelated to :meth:`foo` diff --git a/tests/roots/test-domain-py/roles.rst b/tests/roots/test-domain-py/roles.rst new file mode 100644 index 0000000..6bff2d2 --- /dev/null +++ b/tests/roots/test-domain-py/roles.rst @@ -0,0 +1,48 @@ +roles +===== + +.. py:class:: TopLevel + +.. py:method:: top_level + +* :py:class:`TopLevel` +* :py:meth:`top_level` + + +.. py:class:: NestedParentA + + * Link to :py:meth:`child_1` + + .. py:method:: child_1() + + * Link to :py:meth:`NestedChildA.subchild_2` + * Link to :py:meth:`child_2` + * Link to :any:`any_child` + + .. py:method:: any_child() + + * Link to :py:class:`NestedChildA` + + .. py:class:: NestedChildA + + .. py:method:: subchild_1() + + * Link to :py:meth:`subchild_2` + + .. py:method:: subchild_2() + + Link to :py:meth:`NestedParentA.child_1` + + .. py:method:: child_2() + + Link to :py:meth:`NestedChildA.subchild_1` + +.. py:class:: NestedParentB + + * Link to :py:meth:`child_1` + + .. py:method:: child_1() + + * Link to :py:class:`NestedParentB` + +* :py:class:`NestedParentA.NestedChildA` diff --git a/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme1/theme.conf b/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme1/theme.conf new file mode 100644 index 0000000..89e03bb --- /dev/null +++ b/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme1/theme.conf @@ -0,0 +1,2 @@ +[theme] +inherit = basic diff --git a/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme2/theme.conf b/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme2/theme.conf new file mode 100644 index 0000000..a68c018 --- /dev/null +++ b/tests/roots/test-double-inheriting-theme/base_themes_dir/base_theme2/theme.conf @@ -0,0 +1,2 @@ +[theme] +inherit = base_theme1 diff --git a/tests/roots/test-double-inheriting-theme/conf.py b/tests/roots/test-double-inheriting-theme/conf.py new file mode 100644 index 0000000..3667b02 --- /dev/null +++ b/tests/roots/test-double-inheriting-theme/conf.py @@ -0,0 +1,4 @@ +templates_path = ['_templates'] +html_theme = 'base_theme2' +html_theme_path = ['base_themes_dir'] +exclude_patterns = ['_build'] diff --git a/tests/roots/test-double-inheriting-theme/index.rst b/tests/roots/test-double-inheriting-theme/index.rst new file mode 100644 index 0000000..e67f7ff --- /dev/null +++ b/tests/roots/test-double-inheriting-theme/index.rst @@ -0,0 +1,3 @@ +============================ +Test double inheriting theme +============================ diff --git a/tests/roots/test-environment-record-dependencies/api.rst b/tests/roots/test-environment-record-dependencies/api.rst new file mode 100644 index 0000000..acfb896 --- /dev/null +++ b/tests/roots/test-environment-record-dependencies/api.rst @@ -0,0 +1,4 @@ +API +=== + +.. automodule:: example_module diff --git a/tests/roots/test-environment-record-dependencies/conf.py b/tests/roots/test-environment-record-dependencies/conf.py new file mode 100644 index 0000000..107480e --- /dev/null +++ b/tests/roots/test-environment-record-dependencies/conf.py @@ -0,0 +1,5 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) +extensions = ['sphinx.ext.autodoc'] diff --git a/tests/roots/test-environment-record-dependencies/example_module.py b/tests/roots/test-environment-record-dependencies/example_module.py new file mode 100644 index 0000000..d12dc74 --- /dev/null +++ b/tests/roots/test-environment-record-dependencies/example_module.py @@ -0,0 +1,2 @@ +def example_function(): + return 42 diff --git a/tests/roots/test-environment-record-dependencies/index.rst b/tests/roots/test-environment-record-dependencies/index.rst new file mode 100644 index 0000000..21d88a0 --- /dev/null +++ b/tests/roots/test-environment-record-dependencies/index.rst @@ -0,0 +1,3 @@ +.. toctree:: + + api diff --git a/tests/roots/test-epub-anchor-id/conf.py b/tests/roots/test-epub-anchor-id/conf.py new file mode 100644 index 0000000..2a56f1f --- /dev/null +++ b/tests/roots/test-epub-anchor-id/conf.py @@ -0,0 +1,2 @@ +def setup(app): + app.add_crossref_type(directivename="setting", rolename="setting") diff --git a/tests/roots/test-epub-anchor-id/index.rst b/tests/roots/test-epub-anchor-id/index.rst new file mode 100644 index 0000000..75e3c60 --- /dev/null +++ b/tests/roots/test-epub-anchor-id/index.rst @@ -0,0 +1,13 @@ +test-epub-anchor-id +=================== + +.. setting:: STATICFILES_FINDERS + +blah blah blah + +.. setting:: STATICFILES_SECTION + +blah blah blah +============== + +see :setting:`STATICFILES_FINDERS` diff --git a/tests/roots/test-ext-autodoc/autodoc_dummy_bar.py b/tests/roots/test-ext-autodoc/autodoc_dummy_bar.py new file mode 100644 index 0000000..3b5bbfd --- /dev/null +++ b/tests/roots/test-ext-autodoc/autodoc_dummy_bar.py @@ -0,0 +1,6 @@ +from bug2437.autodoc_dummy_foo import Foo + + +class Bar: + """Dummy class Bar with alias.""" + my_name = Foo diff --git a/tests/roots/test-ext-autodoc/autodoc_dummy_module.py b/tests/roots/test-ext-autodoc/autodoc_dummy_module.py new file mode 100644 index 0000000..c05d96e --- /dev/null +++ b/tests/roots/test-ext-autodoc/autodoc_dummy_module.py @@ -0,0 +1,6 @@ +from dummy import * + + +def test(): + """Dummy function using dummy.*""" + dummy_function() diff --git a/tests/roots/test-ext-autodoc/bug2437/__init__.py b/tests/roots/test-ext-autodoc/bug2437/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-autodoc/bug2437/autodoc_dummy_foo.py b/tests/roots/test-ext-autodoc/bug2437/autodoc_dummy_foo.py new file mode 100644 index 0000000..9c954d8 --- /dev/null +++ b/tests/roots/test-ext-autodoc/bug2437/autodoc_dummy_foo.py @@ -0,0 +1,3 @@ +class Foo: + """Dummy class Foo.""" + pass diff --git a/tests/roots/test-ext-autodoc/circular_import/__init__.py b/tests/roots/test-ext-autodoc/circular_import/__init__.py new file mode 100644 index 0000000..402678d --- /dev/null +++ b/tests/roots/test-ext-autodoc/circular_import/__init__.py @@ -0,0 +1 @@ +from circular_import.c import SomeClass diff --git a/tests/roots/test-ext-autodoc/circular_import/a.py b/tests/roots/test-ext-autodoc/circular_import/a.py new file mode 100644 index 0000000..97ad9d8 --- /dev/null +++ b/tests/roots/test-ext-autodoc/circular_import/a.py @@ -0,0 +1 @@ +X = 42 diff --git a/tests/roots/test-ext-autodoc/circular_import/b.py b/tests/roots/test-ext-autodoc/circular_import/b.py new file mode 100644 index 0000000..c9b8ad5 --- /dev/null +++ b/tests/roots/test-ext-autodoc/circular_import/b.py @@ -0,0 +1,4 @@ +import typing + +if typing.TYPE_CHECKING: + from circular_import import SomeClass diff --git a/tests/roots/test-ext-autodoc/circular_import/c.py b/tests/roots/test-ext-autodoc/circular_import/c.py new file mode 100644 index 0000000..0a8829e --- /dev/null +++ b/tests/roots/test-ext-autodoc/circular_import/c.py @@ -0,0 +1,6 @@ +import circular_import.a +import circular_import.b + + +class SomeClass: + X = circular_import.a.X diff --git a/tests/roots/test-ext-autodoc/conf.py b/tests/roots/test-ext-autodoc/conf.py new file mode 100644 index 0000000..979a709 --- /dev/null +++ b/tests/roots/test-ext-autodoc/conf.py @@ -0,0 +1,15 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc'] + +# The suffix of source filenames. +source_suffix = '.rst' + +autodoc_mock_imports = [ + 'dummy' +] + +nitpicky = True diff --git a/tests/roots/test-ext-autodoc/index.rst b/tests/roots/test-ext-autodoc/index.rst new file mode 100644 index 0000000..eb10829 --- /dev/null +++ b/tests/roots/test-ext-autodoc/index.rst @@ -0,0 +1,15 @@ + +.. automodule:: autodoc_dummy_module + :members: + +.. automodule:: bug2437.autodoc_dummy_foo + :members: + +.. automodule:: autodoc_dummy_bar + :members: + +.. autofunction:: target.typehints.incr + +.. autofunction:: target.overload.sum + +.. autofunction:: target.typehints.tuple_args diff --git a/tests/roots/test-ext-autodoc/target/TYPE_CHECKING.py b/tests/roots/test-ext-autodoc/target/TYPE_CHECKING.py new file mode 100644 index 0000000..85aea3a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/TYPE_CHECKING.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +from gettext import NullTranslations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from collections.abc import Iterable + from io import StringIO + + +class Foo: + attr1: StringIO + + +def spam(ham: Iterable[str]) -> tuple[NullTranslations, bool]: + pass diff --git a/tests/roots/test-ext-autodoc/target/__init__.py b/tests/roots/test-ext-autodoc/target/__init__.py new file mode 100644 index 0000000..d7ee4ac --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/__init__.py @@ -0,0 +1,204 @@ +import enum +from io import StringIO + +from ._functions_to_import import function_to_be_imported + +__all__ = ['Class'] + +#: documentation for the integer +integer = 1 + + +def raises(exc, func, *args, **kwds): + """Raise AssertionError if ``func(*args, **kwds)`` does not raise *exc*.""" + pass + + +class CustomEx(Exception): + """My custom exception.""" + + def f(self): + """Exception method.""" + + +def _funky_classmethod(name, b, c, d, docstring=None): + """Generates a classmethod for a class from a template by filling out + some arguments.""" + def template(cls, a, b, c, d=4, e=5, f=6): + return a, b, c, d, e, f + from functools import partial + function = partial(template, b=b, c=c, d=d) + function.__name__ = name + function.__doc__ = docstring + return classmethod(function) + + +class Class: + """Class to document.""" + + def meth(self): + """Function.""" + + def undocmeth(self): + pass + + def skipmeth(self): + """Method that should be skipped.""" + + def excludemeth(self): + """Method that should be excluded.""" + + # should not be documented + skipattr = 'foo' + + #: should be documented -- süß + attr = 'bar' + + docattr = 'baz' + """should likewise be documented -- süß""" + + udocattr = 'quux' + """should be documented as well - süß""" + + # initialized to any class imported from another module + mdocattr = StringIO() + """should be documented as well - süß""" + + roger = _funky_classmethod("roger", 2, 3, 4) + + moore = _funky_classmethod("moore", 9, 8, 7, + docstring="moore(a, e, f) -> happiness") + + def __init__(self, arg): + self.inst_attr_inline = None #: an inline documented instance attr + #: a documented instance attribute + self.inst_attr_comment = None + self.inst_attr_string = None + """a documented instance attribute""" + self._private_inst_attr = None #: a private instance attribute + + def __special1__(self): + """documented special method""" + + def __special2__(self): + # undocumented special method + pass + + +class CustomDict(dict): + """Docstring.""" + + +def function(foo, *args, **kwds): + """ + Return spam. + """ + pass + + +class Outer: + """Foo""" + + class Inner: + """Foo""" + + def meth(self): + """Foo""" + + # should be documented as an alias + factory = dict + + +class InnerChild(Outer.Inner): + """InnerChild docstring""" + + +class DocstringSig: + def __new__(cls, *new_args, **new_kwargs): + """__new__(cls, d, e=1) -> DocstringSig +First line of docstring + + rest of docstring + """ + + def __init__(self, *init_args, **init_kwargs): + """__init__(self, a, b=1) -> None +First line of docstring + + rest of docstring + """ + + def meth(self): + """meth(FOO, BAR=1) -> BAZ +First line of docstring + + rest of docstring + """ + + def meth2(self): + """First line, no signature + Second line followed by indentation:: + + indented line + """ + + @property + def prop1(self): + """DocstringSig.prop1(self) + First line of docstring + """ + return 123 + + @property + def prop2(self): + """First line of docstring + Second line of docstring + """ + return 456 + + +class StrRepr(str): + """docstring""" + + def __repr__(self): + return self + + +class AttCls: + a1 = StrRepr('hello\nworld') + a2 = None + + +class InstAttCls: + """Class with documented class and instance attributes.""" + + #: Doc comment for class attribute InstAttCls.ca1. + #: It can have multiple lines. + ca1 = 'a' + + ca2 = 'b' #: Doc comment for InstAttCls.ca2. One line only. + + ca3 = 'c' + """Docstring for class attribute InstAttCls.ca3.""" + + def __init__(self): + #: Doc comment for instance attribute InstAttCls.ia1 + self.ia1 = 'd' + + self.ia2 = 'e' + """Docstring for instance attribute InstAttCls.ia2.""" + + +class CustomIter: + def __init__(self): + """Create a new `CustomIter`.""" + self.values = range(10) + + def __iter__(self): + """Iterate squares of each value.""" + for i in self.values: + yield i ** 2 + + def snafucate(self): + """Makes this snafucated.""" + print("snafucated") diff --git a/tests/roots/test-ext-autodoc/target/_functions_to_import.py b/tests/roots/test-ext-autodoc/target/_functions_to_import.py new file mode 100644 index 0000000..7663e97 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/_functions_to_import.py @@ -0,0 +1,8 @@ +from typing import TYPE_CHECKING, Optional + +if TYPE_CHECKING: + from sphinx.application import Sphinx + + +def function_to_be_imported(app: Optional["Sphinx"]) -> str: + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/abstractmethods.py b/tests/roots/test-ext-autodoc/target/abstractmethods.py new file mode 100644 index 0000000..a4396d5 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/abstractmethods.py @@ -0,0 +1,29 @@ +from abc import abstractmethod + + +class Base(): + def meth(self): + pass + + @abstractmethod + def abstractmeth(self): + pass + + @staticmethod + @abstractmethod + def staticmeth(): + pass + + @classmethod + @abstractmethod + def classmeth(cls): + pass + + @property + @abstractmethod + def prop(self): + pass + + @abstractmethod + async def coroutinemeth(self): + pass diff --git a/tests/roots/test-ext-autodoc/target/annotated.py b/tests/roots/test-ext-autodoc/target/annotated.py new file mode 100644 index 0000000..5b87518 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/annotated.py @@ -0,0 +1,8 @@ +from __future__ import annotations + +from typing import Annotated + + +def hello(name: Annotated[str, "attribute"]) -> None: + """docstring""" + pass diff --git a/tests/roots/test-ext-autodoc/target/autoclass_content.py b/tests/roots/test-ext-autodoc/target/autoclass_content.py new file mode 100644 index 0000000..52b9806 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/autoclass_content.py @@ -0,0 +1,47 @@ +class A: + """A class having no __init__, no __new__""" + + +class B: + """A class having __init__(no docstring), no __new__""" + def __init__(self): + pass + + +class C: + """A class having __init__, no __new__""" + def __init__(self): + """__init__ docstring""" + + +class D: + """A class having no __init__, __new__(no docstring)""" + def __new__(cls): + pass + + +class E: + """A class having no __init__, __new__""" + def __new__(cls): + """__new__ docstring""" + + +class F: + """A class having both __init__ and __new__""" + def __init__(self): + """__init__ docstring""" + + def __new__(cls): + """__new__ docstring""" + + +class G(C): + """A class inherits __init__ without docstring.""" + def __init__(self): + pass + + +class H(E): + """A class inherits __new__ without docstring.""" + def __init__(self): + pass diff --git a/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py b/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py new file mode 100644 index 0000000..f2c07a0 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py @@ -0,0 +1,49 @@ +from __future__ import annotations + +import io +from typing import Optional, overload + +myint = int + +#: docstring +variable: myint + +#: docstring +variable2 = None # type: myint + +#: docstring +variable3: Optional[myint] + + +def read(r: io.BytesIO) -> io.StringIO: + """docstring""" + + +def sum(x: myint, y: myint) -> myint: + """docstring""" + return x + y + + +@overload +def mult(x: myint, y: myint) -> myint: + ... + + +@overload +def mult(x: float, y: float) -> float: + ... + + +def mult(x, y): + """docstring""" + return x, y + + +class Foo: + """docstring""" + + #: docstring + attr1: myint + + def __init__(self): + self.attr2: myint = None #: docstring diff --git a/tests/roots/test-ext-autodoc/target/bound_method.py b/tests/roots/test-ext-autodoc/target/bound_method.py new file mode 100644 index 0000000..d48b9ee --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/bound_method.py @@ -0,0 +1,7 @@ +class Cls: + def method(self): + """Method docstring""" + pass + + +bound_method = Cls().method diff --git a/tests/roots/test-ext-autodoc/target/cached_property.py b/tests/roots/test-ext-autodoc/target/cached_property.py new file mode 100644 index 0000000..712d1d9 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/cached_property.py @@ -0,0 +1,12 @@ +from functools import cached_property + + +class Foo: + @cached_property + def prop(self) -> int: + return 1 + + @cached_property + def prop_with_type_comment(self): + # type: () -> int + return 1 diff --git a/tests/roots/test-ext-autodoc/target/callable.py b/tests/roots/test-ext-autodoc/target/callable.py new file mode 100644 index 0000000..6fcd505 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/callable.py @@ -0,0 +1,13 @@ +class Callable(): + """A callable object that behaves like a function.""" + + def __call__(self, arg1, arg2, **kwargs): + pass + + def method(self, arg1, arg2): + """docstring of Callable.method().""" + pass + + +function = Callable() +method = function.method diff --git a/tests/roots/test-ext-autodoc/target/canonical/__init__.py b/tests/roots/test-ext-autodoc/target/canonical/__init__.py new file mode 100644 index 0000000..4ca2b33 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/canonical/__init__.py @@ -0,0 +1 @@ +from target.canonical.original import Bar, Foo diff --git a/tests/roots/test-ext-autodoc/target/canonical/original.py b/tests/roots/test-ext-autodoc/target/canonical/original.py new file mode 100644 index 0000000..42049b2 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/canonical/original.py @@ -0,0 +1,15 @@ +class Foo: + """docstring""" + + def meth(self): + """docstring""" + + +def bar(): + class Bar: + """docstring""" + + return Bar + + +Bar = bar() diff --git a/tests/roots/test-ext-autodoc/target/classes.py b/tests/roots/test-ext-autodoc/target/classes.py new file mode 100644 index 0000000..e5cce7a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/classes.py @@ -0,0 +1,44 @@ +from __future__ import annotations + +from inspect import Parameter, Signature +from typing import List, Union + + +class Foo: + pass + + +class Bar: + def __init__(self, x, y): + pass + + +class Baz: + def __new__(cls, x, y): + pass + + +class Qux: + __signature__ = Signature(parameters=[Parameter('foo', Parameter.POSITIONAL_OR_KEYWORD), + Parameter('bar', Parameter.POSITIONAL_OR_KEYWORD)]) + + def __init__(self, x, y): + pass + + +class Quux(List[Union[int, float]]): + """A subclass of List[Union[int, float]]""" + pass + + +class Corge(Quux): + pass + + +Alias = Foo + +#: docstring +OtherAlias = Bar + +#: docstring +IntAlias = int diff --git a/tests/roots/test-ext-autodoc/target/coroutine.py b/tests/roots/test-ext-autodoc/target/coroutine.py new file mode 100644 index 0000000..f977b6e --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/coroutine.py @@ -0,0 +1,37 @@ +import asyncio +from functools import wraps + + +class AsyncClass: + async def do_coroutine(self): + """A documented coroutine function""" + attr_coro_result = await _other_coro_func() + + @classmethod + async def do_coroutine2(cls): + """A documented coroutine classmethod""" + pass + + @staticmethod + async def do_coroutine3(): + """A documented coroutine staticmethod""" + pass + + async def do_asyncgen(self): + """A documented async generator""" + yield + + +async def _other_coro_func(): + return "run" + + +def myawait(f): + @wraps(f) + def wrapper(*args, **kwargs): + awaitable = f(*args, **kwargs) + return asyncio.run(awaitable) + return wrapper + + +sync_func = myawait(_other_coro_func) diff --git a/tests/roots/test-ext-autodoc/target/cython.pyx b/tests/roots/test-ext-autodoc/target/cython.pyx new file mode 100644 index 0000000..5d0329a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/cython.pyx @@ -0,0 +1,13 @@ +# cython: binding=True +# cython: language_level=3str + +def foo(x: int, *args, y: str, **kwargs): + """Docstring.""" + + +class Class: + """Docstring.""" + + def meth(self, name: str, age: int = 0) -> None: + """Docstring.""" + pass diff --git a/tests/roots/test-ext-autodoc/target/decorator.py b/tests/roots/test-ext-autodoc/target/decorator.py new file mode 100644 index 0000000..faad3ff --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/decorator.py @@ -0,0 +1,53 @@ +from functools import wraps + + +def deco1(func): + """docstring for deco1""" + @wraps(func) + def wrapper(): + return func() + + return wrapper + + +def deco2(condition, message): + """docstring for deco2""" + def decorator(func): + def wrapper(): + return func() + + return wrapper + return decorator + + +@deco1 +def foo(name=None, age=None): + pass + + +class Bar: + @deco1 + def meth(self, name=None, age=None): + pass + + +class Baz: + @deco1 + def __init__(self, name=None, age=None): + pass + + +class Qux: + @deco1 + def __new__(self, name=None, age=None): + pass + + +class _Metaclass(type): + @deco1 + def __call__(self, name=None, age=None): + pass + + +class Quux(metaclass=_Metaclass): + pass diff --git a/tests/roots/test-ext-autodoc/target/descriptor.py b/tests/roots/test-ext-autodoc/target/descriptor.py new file mode 100644 index 0000000..2857c99 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/descriptor.py @@ -0,0 +1,31 @@ +class CustomDataDescriptor: + """Descriptor class docstring.""" + + def __init__(self, doc): + self.__doc__ = doc + + def __get__(self, obj, type=None): + if obj is None: + return self + return 42 + + def meth(self): + """Function.""" + return "The Answer" + + +class CustomDataDescriptorMeta(type): + """Descriptor metaclass docstring.""" + + +class CustomDataDescriptor2(CustomDataDescriptor): + """Descriptor class with custom metaclass docstring.""" + __metaclass__ = CustomDataDescriptorMeta + + +class Class: + descr = CustomDataDescriptor("Descriptor instance docstring.") + + @property + def prop(self): + """Property.""" diff --git a/tests/roots/test-ext-autodoc/target/docstring_signature.py b/tests/roots/test-ext-autodoc/target/docstring_signature.py new file mode 100644 index 0000000..981d936 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/docstring_signature.py @@ -0,0 +1,33 @@ +class A: + """A(foo, bar)""" + + +class B: + """B(foo, bar)""" + def __init__(self): + """B(foo, bar, baz)""" + + +class C: + """C(foo, bar)""" + def __new__(cls): + """C(foo, bar, baz)""" + + +class D: + def __init__(self): + """D(foo, bar, baz)""" + + +class E: + def __init__(self): + """E(foo: int, bar: int, baz: int) -> None \\ + E(foo: str, bar: str, baz: str) -> None \\ + E(foo: float, bar: float, baz: float)""" + + +class F: + def __init__(self): + """F(foo: int, bar: int, baz: int) -> None + F(foo: str, bar: str, baz: str) -> None + F(foo: float, bar: float, baz: float)""" diff --git a/tests/roots/test-ext-autodoc/target/empty_all.py b/tests/roots/test-ext-autodoc/target/empty_all.py new file mode 100644 index 0000000..c094cff --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/empty_all.py @@ -0,0 +1,16 @@ +""" +docsting of empty_all module. +""" +__all__ = [] + + +def foo(): + """docstring""" + + +def bar(): + """docstring""" + + +def baz(): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/enums.py b/tests/roots/test-ext-autodoc/target/enums.py new file mode 100644 index 0000000..c69455f --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/enums.py @@ -0,0 +1,23 @@ +import enum + + +class EnumCls(enum.Enum): + """ + this is enum class + """ + + #: doc for val1 + val1 = 12 + val2 = 23 #: doc for val2 + val3 = 34 + """doc for val3""" + val4 = 34 + + def say_hello(self): + """a method says hello to you.""" + pass + + @classmethod + def say_goodbye(cls): + """a classmethod says good-bye to you.""" + pass diff --git a/tests/roots/test-ext-autodoc/target/final.py b/tests/roots/test-ext-autodoc/target/final.py new file mode 100644 index 0000000..a8c3860 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/final.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +import typing +from typing import final + + +@typing.final +class Class: + """docstring""" + + @final + def meth1(self): + """docstring""" + + def meth2(self): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/functions.py b/tests/roots/test-ext-autodoc/target/functions.py new file mode 100644 index 0000000..b62aa70 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/functions.py @@ -0,0 +1,19 @@ +from functools import partial + + +def func(): + pass + + +async def coroutinefunc(): + pass + + +async def asyncgenerator(): + yield + +partial_func = partial(func) +partial_coroutinefunc = partial(coroutinefunc) + +builtin_func = print +partial_builtin_func = partial(print) diff --git a/tests/roots/test-ext-autodoc/target/generic_class.py b/tests/roots/test-ext-autodoc/target/generic_class.py new file mode 100644 index 0000000..1ec8058 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/generic_class.py @@ -0,0 +1,13 @@ +from __future__ import annotations + +from typing import Generic, TypeVar + +T = TypeVar('T') + + +# Test that typing.Generic's __new__ method does not mask our class' +# __init__ signature. +class A(Generic[T]): + """docstring for A""" + def __init__(self, a, b=None): + pass diff --git a/tests/roots/test-ext-autodoc/target/genericalias.py b/tests/roots/test-ext-autodoc/target/genericalias.py new file mode 100644 index 0000000..06026fb --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/genericalias.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +from typing import Callable, List + +#: A list of int +T = List[int] + +C = Callable[[int], None] # a generic alias not having a doccomment + + +class Class: + #: A list of int + T = List[int] + +#: A list of Class +L = List[Class] diff --git a/tests/roots/test-ext-autodoc/target/hide_value.py b/tests/roots/test-ext-autodoc/target/hide_value.py new file mode 100644 index 0000000..1d53aab --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/hide_value.py @@ -0,0 +1,19 @@ +#: docstring +#: +#: :meta hide-value: +SENTINEL1 = object() + +#: :meta hide-value: +SENTINEL2 = object() + + +class Foo: + """docstring""" + + #: docstring + #: + #: :meta hide-value: + SENTINEL1 = object() + + #: :meta hide-value: + SENTINEL2 = object() diff --git a/tests/roots/test-ext-autodoc/target/imported_members.py b/tests/roots/test-ext-autodoc/target/imported_members.py new file mode 100644 index 0000000..ee6e5b3 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/imported_members.py @@ -0,0 +1 @@ +from .partialfunction import func2, func3 diff --git a/tests/roots/test-ext-autodoc/target/inheritance.py b/tests/roots/test-ext-autodoc/target/inheritance.py new file mode 100644 index 0000000..e06f7a8 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/inheritance.py @@ -0,0 +1,25 @@ +class Base: + #: docstring + inheritedattr = None + + def inheritedmeth(self): + """Inherited function.""" + + @classmethod + def inheritedclassmeth(cls): + """Inherited class method.""" + + @staticmethod + def inheritedstaticmeth(cls): + """Inherited static method.""" + + +class Derived(Base): + def inheritedmeth(self): + # no docstring here + pass + + +class MyList(list): + def meth(self): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/instance_variable.py b/tests/roots/test-ext-autodoc/target/instance_variable.py new file mode 100644 index 0000000..1d393bc --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/instance_variable.py @@ -0,0 +1,11 @@ +class Foo: + def __init__(self): + self.attr1 = None #: docstring foo + self.attr2 = None #: docstring foo + + +class Bar(Foo): + def __init__(self): + self.attr2 = None #: docstring bar + self.attr3 = None #: docstring bar + self.attr4 = None diff --git a/tests/roots/test-ext-autodoc/target/literal.py b/tests/roots/test-ext-autodoc/target/literal.py new file mode 100644 index 0000000..4340e51 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/literal.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +from enum import Enum +from typing import Literal, TypeVar + + +class MyEnum(Enum): + a = 1 + + +T = TypeVar('T', bound=Literal[1234]) +"""docstring""" + + +U = TypeVar('U', bound=Literal[MyEnum.a]) +"""docstring""" + + +def bar(x: Literal[1234]): + """docstring""" + + +def foo(x: Literal[MyEnum.a]): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/metadata.py b/tests/roots/test-ext-autodoc/target/metadata.py new file mode 100644 index 0000000..7a4488f --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/metadata.py @@ -0,0 +1,2 @@ +def foo(): + """:meta metadata-only-docstring:""" diff --git a/tests/roots/test-ext-autodoc/target/methods.py b/tests/roots/test-ext-autodoc/target/methods.py new file mode 100644 index 0000000..ad5a6a9 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/methods.py @@ -0,0 +1,29 @@ +from functools import partialmethod + + +class Base(): + def meth(self): + pass + + @staticmethod + def staticmeth(): + pass + + @classmethod + def classmeth(cls): + pass + + @property + def prop(self): + pass + + partialmeth = partialmethod(meth) + + async def coroutinemeth(self): + pass + + partial_coroutinemeth = partialmethod(coroutinemeth) + + +class Inherited(Base): + pass diff --git a/tests/roots/test-ext-autodoc/target/module.py b/tests/roots/test-ext-autodoc/target/module.py new file mode 100644 index 0000000..fe3b490 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/module.py @@ -0,0 +1,14 @@ +undocumented = 1 + +#: docstring +documented = 1 + +undoc_annotated: int + +#: docstring +annotated: int + +__special__ = 1 + +#: docstring +__documented_special__ = 1 diff --git a/tests/roots/test-ext-autodoc/target/name_conflict/__init__.py b/tests/roots/test-ext-autodoc/target/name_conflict/__init__.py new file mode 100644 index 0000000..0a6f496 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/name_conflict/__init__.py @@ -0,0 +1,6 @@ +from .foo import bar + + +class foo: + """docstring of target.name_conflict::foo.""" + pass diff --git a/tests/roots/test-ext-autodoc/target/name_conflict/foo.py b/tests/roots/test-ext-autodoc/target/name_conflict/foo.py new file mode 100644 index 0000000..bb83ca0 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/name_conflict/foo.py @@ -0,0 +1,2 @@ +class bar: + """docstring of target.name_conflict.foo::bar.""" diff --git a/tests/roots/test-ext-autodoc/target/name_mangling.py b/tests/roots/test-ext-autodoc/target/name_mangling.py new file mode 100644 index 0000000..269b51d --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/name_mangling.py @@ -0,0 +1,11 @@ +class Foo: + #: name of Foo + __name = None + __age = None + + +class Bar(Foo): + __address = None + + #: a member having mangled-like name + _Baz__email = None diff --git a/tests/roots/test-ext-autodoc/target/need_mocks.py b/tests/roots/test-ext-autodoc/target/need_mocks.py new file mode 100644 index 0000000..881220b --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/need_mocks.py @@ -0,0 +1,42 @@ +import missing_module +import missing_package1.missing_module1 +from missing_module import missing_name +from missing_package2 import missing_module2 +from missing_package3.missing_module3 import missing_name + +import sphinx.missing_module4 +from sphinx.missing_module4 import missing_name2 + + +@missing_name(int) +def decoratedFunction(): + """decoratedFunction docstring""" + return None + + +def func(arg: missing_module.Class): + """a function takes mocked object as an argument""" + pass + + +class TestAutodoc: + """TestAutodoc docstring.""" + + #: docstring + Alias = missing_module2.Class + + @missing_name + def decoratedMethod(self): + """TestAutodoc::decoratedMethod docstring""" + return None + + +class Inherited(missing_module.Class): + """docstring""" + pass + + +sphinx.missing_module4.missing_function(len(missing_name2)) + +#: docstring +Alias = missing_module2.Class diff --git a/tests/roots/test-ext-autodoc/target/overload.py b/tests/roots/test-ext-autodoc/target/overload.py new file mode 100644 index 0000000..4bcb6ea --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/overload.py @@ -0,0 +1,90 @@ +from __future__ import annotations + +from typing import Any, overload + + +@overload +def sum(x: int, y: int = 0) -> int: + ... + + +@overload +def sum(x: float, y: float = 0.0) -> float: + ... + + +@overload +def sum(x: str, y: str = ...) -> str: + ... + + +def sum(x, y=None): + """docstring""" + return x + y + + +class Math: + """docstring""" + + @overload + def sum(self, x: int, y: int = 0) -> int: + ... + + @overload + def sum(self, x: float, y: float = 0.0) -> float: + ... + + @overload + def sum(self, x: str, y: str = ...) -> str: + ... + + def sum(self, x, y=None): + """docstring""" + return x + y + + +class Foo: + """docstring""" + + @overload + def __new__(cls, x: int, y: int) -> Foo: + ... + + @overload + def __new__(cls, x: str, y: str) -> Foo: + ... + + def __new__(cls, x, y): + pass + + +class Bar: + """docstring""" + + @overload + def __init__(cls, x: int, y: int) -> None: + ... + + @overload + def __init__(cls, x: str, y: str) -> None: + ... + + def __init__(cls, x, y): + pass + + +class Meta(type): + @overload + def __call__(cls, x: int, y: int) -> Any: + ... + + @overload + def __call__(cls, x: str, y: str) -> Any: + ... + + def __call__(cls, x, y): + pass + + +class Baz(metaclass=Meta): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/overload2.py b/tests/roots/test-ext-autodoc/target/overload2.py new file mode 100644 index 0000000..e901f79 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/overload2.py @@ -0,0 +1,5 @@ +from target.overload import Bar + + +class Baz(Bar): + pass diff --git a/tests/roots/test-ext-autodoc/target/partialfunction.py b/tests/roots/test-ext-autodoc/target/partialfunction.py new file mode 100644 index 0000000..3be63ee --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/partialfunction.py @@ -0,0 +1,12 @@ +from functools import partial + + +def func1(a, b, c): + """docstring of func1""" + pass + + +func2 = partial(func1, 1) +func3 = partial(func2, 2) +func3.__doc__ = "docstring of func3" +func4 = partial(func3, 3) diff --git a/tests/roots/test-ext-autodoc/target/partialmethod.py b/tests/roots/test-ext-autodoc/target/partialmethod.py new file mode 100644 index 0000000..20d75e9 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/partialmethod.py @@ -0,0 +1,17 @@ +from functools import partialmethod + + +class Cell: + """An example for partialmethod. + + refs: https://docs.python.jp/3/library/functools.html#functools.partialmethod + """ + + def set_state(self, state): + """Update state of cell to *state*.""" + + #: Make a cell alive. + set_alive = partialmethod(set_state, True) + + # a partialmethod with no docstring + set_dead = partialmethod(set_state, False) diff --git a/tests/roots/test-ext-autodoc/target/pep570.py b/tests/roots/test-ext-autodoc/target/pep570.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-autodoc/target/pep604.py b/tests/roots/test-ext-autodoc/target/pep604.py new file mode 100644 index 0000000..9b1f94a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/pep604.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +attr: int | str #: docstring + + +def sum(x: int | str, y: int | str) -> int | str: + """docstring""" + + +class Foo: + """docstring""" + + attr: int | str #: docstring + + def meth(self, x: int | str, y: int | str) -> int | str: + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/preserve_defaults.py b/tests/roots/test-ext-autodoc/target/preserve_defaults.py new file mode 100644 index 0000000..86e1038 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/preserve_defaults.py @@ -0,0 +1,60 @@ +from __future__ import annotations + +from datetime import datetime +from typing import Any + +CONSTANT = 'foo' +SENTINEL = object() + + +def foo(name: str = CONSTANT, + sentinel: Any = SENTINEL, + now: datetime = datetime.now(), + color: int = 0xFFFFFF, + *, + kwarg1, + kwarg2 = 0xFFFFFF) -> None: + """docstring""" + + +class Class: + """docstring""" + + def meth(self, name: str = CONSTANT, sentinel: Any = SENTINEL, + now: datetime = datetime.now(), color: int = 0xFFFFFF, + *, kwarg1, kwarg2 = 0xFFFFFF) -> None: + """docstring""" + + @classmethod + def clsmeth(cls, name: str = CONSTANT, sentinel: Any = SENTINEL, + now: datetime = datetime.now(), color: int = 0xFFFFFF, + *, kwarg1, kwarg2 = 0xFFFFFF) -> None: + """docstring""" + + +get_sentinel = lambda custom=SENTINEL: custom +"""docstring""" + + +class MultiLine: + """docstring""" + + # The properties will raise a silent SyntaxError because "lambda self: 1" + # will be detected as a function to update the default values of. However, + # only prop3 will not fail because it's on a single line whereas the others + # will fail to parse. + + prop1 = property( + lambda self: 1, doc="docstring") + + prop2 = property( + lambda self: 2, doc="docstring" + ) + + prop3 = property(lambda self: 3, doc="docstring") + + prop4 = (property + (lambda self: 4, doc="docstring")) + + prop5 = property\ + (lambda self: 5, doc="docstring") diff --git a/tests/roots/test-ext-autodoc/target/preserve_defaults_special_constructs.py b/tests/roots/test-ext-autodoc/target/preserve_defaults_special_constructs.py new file mode 100644 index 0000000..0fdb11a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/preserve_defaults_special_constructs.py @@ -0,0 +1,50 @@ +from __future__ import annotations + +from collections import namedtuple +from dataclasses import dataclass, field +from typing import NamedTuple, TypedDict + +#: docstring +SENTINEL = object() + + +#: docstring +ze_lambda = lambda z=SENTINEL: None + + +def foo(x, y, z=SENTINEL): + """docstring""" + + +@dataclass +class DataClass: + """docstring""" + a: int + b: object = SENTINEL + c: list[int] = field(default_factory=lambda: [1, 2, 3]) + + +@dataclass(init=False) +class DataClassNoInit: + """docstring""" + a: int + b: object = SENTINEL + c: list[int] = field(default_factory=lambda: [1, 2, 3]) + + +class MyTypedDict(TypedDict): + """docstring""" + a: int + b: object + c: list[int] + + +class MyNamedTuple1(NamedTuple): + """docstring""" + a: int + b: object = object() + c: list[int] = [1, 2, 3] + + +class MyNamedTuple2(namedtuple('Base', ('a', 'b'), defaults=(0, SENTINEL))): + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/private.py b/tests/roots/test-ext-autodoc/target/private.py new file mode 100644 index 0000000..e463448 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/private.py @@ -0,0 +1,27 @@ +def private_function(name): + """private_function is a docstring(). + + :meta private: + """ + +def _public_function(name): + """public_function is a docstring(). + + :meta public: + """ + + +PRIVATE_CONSTANT = None #: :meta private: +_PUBLIC_CONSTANT = None #: :meta public: + + +class Foo: + #: A public class attribute whose name starts with an underscore. + #: + #: :meta public: + _public_attribute = 47 + + #: A private class attribute whose name does not start with an underscore. + #: + #: :meta private: + private_attribute = 11 diff --git a/tests/roots/test-ext-autodoc/target/process_docstring.py b/tests/roots/test-ext-autodoc/target/process_docstring.py new file mode 100644 index 0000000..6005943 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/process_docstring.py @@ -0,0 +1,8 @@ +def func(): + """ + first line + --- + second line + --- + third line + """ diff --git a/tests/roots/test-ext-autodoc/target/properties.py b/tests/roots/test-ext-autodoc/target/properties.py new file mode 100644 index 0000000..018f51e --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/properties.py @@ -0,0 +1,22 @@ +class Foo: + """docstring""" + + @property + def prop1(self) -> int: + """docstring""" + + @classmethod + @property + def prop2(self) -> int: + """docstring""" + + @property + def prop1_with_type_comment(self): + # type: () -> int + """docstring""" + + @classmethod + @property + def prop2_with_type_comment(self): + # type: () -> int + """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/singledispatch.py b/tests/roots/test-ext-autodoc/target/singledispatch.py new file mode 100644 index 0000000..3dd5aaf --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/singledispatch.py @@ -0,0 +1,36 @@ +import inspect +from functools import singledispatch + + +def assign_signature(func): + # This is intended to cover more complex signature-rewriting decorators. + func.__signature__ = inspect.signature(func) + return func + + +@singledispatch +def func(arg, kwarg=None): + """A function for general use.""" + pass + + +@func.register(int) +@func.register(float) +def _func_int(arg, kwarg=None): + """A function for int.""" + pass + + +@func.register(str) +@assign_signature +def _func_str(arg, kwarg=None): + """A function for str.""" + pass + + +@func.register +def _func_dict(arg: dict, kwarg=None): + """A function for dict.""" + # This function tests for specifying type through annotations + pass + diff --git a/tests/roots/test-ext-autodoc/target/singledispatchmethod.py b/tests/roots/test-ext-autodoc/target/singledispatchmethod.py new file mode 100644 index 0000000..fb92293 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/singledispatchmethod.py @@ -0,0 +1,27 @@ +from functools import singledispatchmethod + + +class Foo: + """docstring""" + + @singledispatchmethod + def meth(self, arg, kwarg=None): + """A method for general use.""" + pass + + @meth.register(int) + @meth.register(float) + def _meth_int(self, arg, kwarg=None): + """A method for int.""" + pass + + @meth.register(str) + def _meth_str(self, arg, kwarg=None): + """A method for str.""" + pass + + @meth.register + def _meth_dict(self, arg: dict, kwarg=None): + """A method for dict.""" + # This function tests for specifying type through annotations + pass diff --git a/tests/roots/test-ext-autodoc/target/slots.py b/tests/roots/test-ext-autodoc/target/slots.py new file mode 100644 index 0000000..75c7a4a --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/slots.py @@ -0,0 +1,22 @@ +class Foo: + """docstring""" + + __slots__ = ['attr'] + + +class Bar: + """docstring""" + + __slots__ = {'attr1': 'docstring of attr1', + 'attr2': 'docstring of attr2', + 'attr3': None} + __annotations__ = {'attr1': int} + + def __init__(self): + self.attr2 = None #: docstring of instance attr2 + + +class Baz: + """docstring""" + + __slots__ = 'attr' diff --git a/tests/roots/test-ext-autodoc/target/sort_by_all.py b/tests/roots/test-ext-autodoc/target/sort_by_all.py new file mode 100644 index 0000000..03def47 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/sort_by_all.py @@ -0,0 +1,25 @@ +__all__ = ['baz', 'foo', 'Bar'] + + +def foo(): + pass + + +class Bar: + pass + + +def baz(): + pass + + +def qux(): + pass + + +class Quux: + pass + + +def foobar(): + pass diff --git a/tests/roots/test-ext-autodoc/target/typed_vars.py b/tests/roots/test-ext-autodoc/target/typed_vars.py new file mode 100644 index 0000000..0fe7468 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/typed_vars.py @@ -0,0 +1,34 @@ +#: attr1 +attr1: str = '' +#: attr2 +attr2: str +#: attr3 +attr3 = '' # type: str + + +class _Descriptor: + def __init__(self, name): + self.__doc__ = f"This is {name}" + def __get__(self): + pass + + +class Class: + attr1: int = 0 + attr2: int + attr3 = 0 # type: int + + descr4: int = _Descriptor("descr4") + + def __init__(self): + self.attr4: int = 0 #: attr4 + self.attr5: int #: attr5 + self.attr6 = 0 # type: int + """attr6""" + + +class Derived(Class): + attr7: int + + +Alias = Derived diff --git a/tests/roots/test-ext-autodoc/target/typehints.py b/tests/roots/test-ext-autodoc/target/typehints.py new file mode 100644 index 0000000..9071594 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/typehints.py @@ -0,0 +1,105 @@ +from __future__ import annotations + +import pathlib +from typing import Any, Tuple, TypeVar, Union + +CONST1: int +#: docstring +CONST2: int = 1 +#: docstring +CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath("/a/b/c") +#: docstring +T = TypeVar("T", bound=pathlib.PurePosixPath) + + +def incr(a: int, b: int = 1) -> int: + return a + b + + +def decr(a, b = 1): + # type: (int, int) -> int + return a - b + + +class Math: + CONST1: int + CONST2: int = 1 + CONST3: pathlib.PurePosixPath = pathlib.PurePosixPath("/a/b/c") + + def __init__(self, s: str, o: Any = None) -> None: + pass + + def incr(self, a: int, b: int = 1) -> int: + return a + b + + def decr(self, a, b = 1): + # type: (int, int) -> int + return a - b + + def nothing(self): + # type: () -> None + pass + + def horse(self, + a, # type: str + b, # type: int + ): + # type: (...) -> None + return + + @property + def prop(self) -> int: + return 0 + + @property + def path(self) -> pathlib.PurePosixPath: + return pathlib.PurePosixPath("/a/b/c") + + +def tuple_args(x: tuple[int, int | str]) -> tuple[int, int]: + pass + + +class NewAnnotation: + def __new__(cls, i: int) -> NewAnnotation: + pass + + +class NewComment: + def __new__(cls, i): + # type: (int) -> NewComment + pass + + +class _MetaclassWithCall(type): + def __call__(cls, a: int): + pass + + +class SignatureFromMetaclass(metaclass=_MetaclassWithCall): + pass + + +def complex_func(arg1, arg2, arg3=None, *args, **kwargs): + # type: (str, List[int], Tuple[int, Union[str, Unknown]], *str, **str) -> None + pass + + +def missing_attr(c, + a, # type: str + b=None # type: Optional[str] + ): + # type: (...) -> str + return a + (b or "") + + +class _ClassWithDocumentedInit: + """Class docstring.""" + + def __init__(self, x: int, *args: int, **kwargs: int) -> None: + """Init docstring. + + :param x: Some integer + :param args: Some integer + :param kwargs: Some integer + """ diff --git a/tests/roots/test-ext-autodoc/target/typevar.py b/tests/roots/test-ext-autodoc/target/typevar.py new file mode 100644 index 0000000..1a02f3e --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/typevar.py @@ -0,0 +1,32 @@ +from __future__ import annotations + +from datetime import date +from typing import NewType, TypeVar + +#: T1 +T1 = TypeVar("T1") + +T2 = TypeVar("T2") # A TypeVar not having doc comment + +#: T3 +T3 = TypeVar("T3", int, str) + +#: T4 +T4 = TypeVar("T4", covariant=True) + +#: T5 +T5 = TypeVar("T5", contravariant=True) + +#: T6 +T6 = NewType("T6", date) + +#: T7 +T7 = TypeVar("T7", bound=int) + + +class Class: + #: T1 + T1 = TypeVar("T1") + + #: T6 + T6 = NewType("T6", date) diff --git a/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py b/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py new file mode 100644 index 0000000..e0f229c --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/uninitialized_attributes.py @@ -0,0 +1,8 @@ +class Base: + attr1: int #: docstring + attr2: str + + +class Derived(Base): + attr3: int #: docstring + attr4: str diff --git a/tests/roots/test-ext-autodoc/target/wrappedfunction.py b/tests/roots/test-ext-autodoc/target/wrappedfunction.py new file mode 100644 index 0000000..064d777 --- /dev/null +++ b/tests/roots/test-ext-autodoc/target/wrappedfunction.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +from contextlib import contextmanager +from functools import lru_cache +from typing import Generator + + +@lru_cache(maxsize=None) +def slow_function(message, timeout): + """This function is slow.""" + print(message) + + +@contextmanager +def feeling_good(x: int, y: int) -> Generator: + """You'll feel better in this context!""" + yield diff --git a/tests/roots/test-ext-autosectionlabel-prefix-document/conf.py b/tests/roots/test-ext-autosectionlabel-prefix-document/conf.py new file mode 100644 index 0000000..78fb56c --- /dev/null +++ b/tests/roots/test-ext-autosectionlabel-prefix-document/conf.py @@ -0,0 +1,2 @@ +extensions = ['sphinx.ext.autosectionlabel'] +autosectionlabel_prefix_document = True diff --git a/tests/roots/test-ext-autosectionlabel-prefix-document/index.rst b/tests/roots/test-ext-autosectionlabel-prefix-document/index.rst new file mode 100644 index 0000000..d767373 --- /dev/null +++ b/tests/roots/test-ext-autosectionlabel-prefix-document/index.rst @@ -0,0 +1,37 @@ +========================================= +test-ext-autosectionlabel-prefix-document +========================================= + + +Introduce of Sphinx +=================== + +Installation +============ + +For Windows users +----------------- + +For UNIX users +-------------- + +Linux +^^^^^ + +FreeBSD +^^^^^^^ + +This one's got an apostrophe +---------------------------- + + +References +========== + +* :ref:`index:Introduce of Sphinx` +* :ref:`index:Installation` +* :ref:`index:For Windows users` +* :ref:`index:For UNIX users` +* :ref:`index:Linux` +* :ref:`index:FreeBSD` +* :ref:`index:This one's got an apostrophe` diff --git a/tests/roots/test-ext-autosectionlabel/conf.py b/tests/roots/test-ext-autosectionlabel/conf.py new file mode 100644 index 0000000..31e93ff --- /dev/null +++ b/tests/roots/test-ext-autosectionlabel/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.autosectionlabel'] diff --git a/tests/roots/test-ext-autosectionlabel/index.rst b/tests/roots/test-ext-autosectionlabel/index.rst new file mode 100644 index 0000000..133206e --- /dev/null +++ b/tests/roots/test-ext-autosectionlabel/index.rst @@ -0,0 +1,37 @@ +========================= +test-ext-autosectionlabel +========================= + + +Introduce of Sphinx +=================== + +Installation +============ + +For Windows users +----------------- + +For UNIX users +-------------- + +Linux +^^^^^ + +FreeBSD +^^^^^^^ + +This one's got an apostrophe +---------------------------- + +References +========== + +* :ref:`test-ext-autosectionlabel` +* :ref:`Introduce of Sphinx` +* :ref:`Installation` +* :ref:`For Windows users` +* :ref:`For UNIX users` +* :ref:`Linux` +* :ref:`FreeBSD` +* :ref:`This one's got an apostrophe` diff --git a/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py new file mode 100644 index 0000000..b88e335 --- /dev/null +++ b/tests/roots/test-ext-autosummary-filename-map/autosummary_dummy_module.py @@ -0,0 +1,23 @@ +from __future__ import annotations + +from os import path +from typing import Union + + +class Foo: + class Bar: + pass + + def __init__(self): + pass + + def bar(self): + pass + + @property + def baz(self): + pass + + +def bar(x: int | str, y: int = 1) -> None: + pass diff --git a/tests/roots/test-ext-autosummary-filename-map/conf.py b/tests/roots/test-ext-autosummary-filename-map/conf.py new file mode 100644 index 0000000..17e2fa4 --- /dev/null +++ b/tests/roots/test-ext-autosummary-filename-map/conf.py @@ -0,0 +1,11 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autosummary_filename_map = { + "autosummary_dummy_module": "module_mangled", + "autosummary_dummy_module.bar": "bar" +} diff --git a/tests/roots/test-ext-autosummary-filename-map/index.rst b/tests/roots/test-ext-autosummary-filename-map/index.rst new file mode 100644 index 0000000..57d902b --- /dev/null +++ b/tests/roots/test-ext-autosummary-filename-map/index.rst @@ -0,0 +1,9 @@ + +.. autosummary:: + :toctree: generated + :caption: An autosummary + + autosummary_dummy_module + autosummary_dummy_module.Foo + autosummary_dummy_module.Foo.bar + autosummary_dummy_module.bar diff --git a/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/__init__.py b/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/__init__.py new file mode 100644 index 0000000..0a7d9f3 --- /dev/null +++ b/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/__init__.py @@ -0,0 +1 @@ +from .autosummary_dummy_module import Bar, foo diff --git a/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/autosummary_dummy_module.py new file mode 100644 index 0000000..9c93f06 --- /dev/null +++ b/tests/roots/test-ext-autosummary-imported_members/autosummary_dummy_package/autosummary_dummy_module.py @@ -0,0 +1,8 @@ +class Bar: + """Bar class""" + pass + + +def foo(): + """Foo function""" + pass diff --git a/tests/roots/test-ext-autosummary-imported_members/conf.py b/tests/roots/test-ext-autosummary-imported_members/conf.py new file mode 100644 index 0000000..77af668 --- /dev/null +++ b/tests/roots/test-ext-autosummary-imported_members/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autosummary_imported_members = True diff --git a/tests/roots/test-ext-autosummary-imported_members/index.rst b/tests/roots/test-ext-autosummary-imported_members/index.rst new file mode 100644 index 0000000..1c55126 --- /dev/null +++ b/tests/roots/test-ext-autosummary-imported_members/index.rst @@ -0,0 +1,7 @@ +test-ext-autosummary-imported_members +===================================== + +.. autosummary:: + :toctree: generated + + autosummary_dummy_package diff --git a/tests/roots/test-ext-autosummary-mock_imports/conf.py b/tests/roots/test-ext-autosummary-mock_imports/conf.py new file mode 100644 index 0000000..121f814 --- /dev/null +++ b/tests/roots/test-ext-autosummary-mock_imports/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autosummary_mock_imports = ['unknown'] diff --git a/tests/roots/test-ext-autosummary-mock_imports/foo.py b/tests/roots/test-ext-autosummary-mock_imports/foo.py new file mode 100644 index 0000000..ab4460e --- /dev/null +++ b/tests/roots/test-ext-autosummary-mock_imports/foo.py @@ -0,0 +1,6 @@ +import unknown + + +class Foo(unknown.Class): + """Foo class""" + pass diff --git a/tests/roots/test-ext-autosummary-mock_imports/index.rst b/tests/roots/test-ext-autosummary-mock_imports/index.rst new file mode 100644 index 0000000..f6044ed --- /dev/null +++ b/tests/roots/test-ext-autosummary-mock_imports/index.rst @@ -0,0 +1,7 @@ +test-ext-autosummary-mock_imports +================================= + +.. autosummary:: + :toctree: generated + + foo diff --git a/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/__init__.py b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/__init__.py new file mode 100644 index 0000000..82f2060 --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/__init__.py @@ -0,0 +1,13 @@ +from .autosummary_dummy_module import Bar, PublicBar, foo, public_foo + + +def baz(): + """Baz function""" + pass + + +def public_baz(): + """Public Baz function""" + + +__all__ = ["PublicBar", "public_foo", "public_baz", "extra_dummy_module"] diff --git a/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/autosummary_dummy_module.py new file mode 100644 index 0000000..ef89e22 --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/autosummary_dummy_module.py @@ -0,0 +1,20 @@ +class Bar: + """Bar class""" + + pass + + +class PublicBar: + """Public Bar class""" + + pass + + +def foo(): + """Foo function""" + pass + + +def public_foo(): + """Public Foo function""" + pass diff --git a/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/extra_dummy_module.py b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/extra_dummy_module.py new file mode 100644 index 0000000..ef89e22 --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/autosummary_dummy_package_all/extra_dummy_module.py @@ -0,0 +1,20 @@ +class Bar: + """Bar class""" + + pass + + +class PublicBar: + """Public Bar class""" + + pass + + +def foo(): + """Foo function""" + pass + + +def public_foo(): + """Public Foo function""" + pass diff --git a/tests/roots/test-ext-autosummary-module_all/conf.py b/tests/roots/test-ext-autosummary-module_all/conf.py new file mode 100644 index 0000000..c6ff534 --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autosummary_ignore_module_all = False diff --git a/tests/roots/test-ext-autosummary-module_all/index.rst b/tests/roots/test-ext-autosummary-module_all/index.rst new file mode 100644 index 0000000..cd638ad --- /dev/null +++ b/tests/roots/test-ext-autosummary-module_all/index.rst @@ -0,0 +1,8 @@ +test-ext-autosummary-module_all +=============================== + +.. autosummary:: + :toctree: generated + :recursive: + + autosummary_dummy_package_all diff --git a/tests/roots/test-ext-autosummary-recursive/conf.py b/tests/roots/test-ext-autosummary-recursive/conf.py new file mode 100644 index 0000000..1c0d022 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/conf.py @@ -0,0 +1,7 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True diff --git a/tests/roots/test-ext-autosummary-recursive/index.rst b/tests/roots/test-ext-autosummary-recursive/index.rst new file mode 100644 index 0000000..5855bfa --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/index.rst @@ -0,0 +1,15 @@ +API Reference +============= + +.. rubric:: Packages + +.. autosummary:: + :toctree: generated + :recursive: + + package + +.. autosummary:: + :toctree: generated + + package2 diff --git a/tests/roots/test-ext-autosummary-recursive/package/__init__.py b/tests/roots/test-ext-autosummary-recursive/package/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-autosummary-recursive/package/module.py b/tests/roots/test-ext-autosummary-recursive/package/module.py new file mode 100644 index 0000000..c76e733 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package/module.py @@ -0,0 +1,13 @@ +from os import * + + +class Foo: + def __init__(self): + pass + + def bar(self): + pass + + @property + def baz(self): + pass diff --git a/tests/roots/test-ext-autosummary-recursive/package/module_importfail.py b/tests/roots/test-ext-autosummary-recursive/package/module_importfail.py new file mode 100644 index 0000000..5c6ce56 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package/module_importfail.py @@ -0,0 +1,2 @@ +# Fail module import in a catastrophic way +raise SystemExit(1) diff --git a/tests/roots/test-ext-autosummary-recursive/package/package/__init__.py b/tests/roots/test-ext-autosummary-recursive/package/package/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-autosummary-recursive/package/package/module.py b/tests/roots/test-ext-autosummary-recursive/package/package/module.py new file mode 100644 index 0000000..c76e733 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package/package/module.py @@ -0,0 +1,13 @@ +from os import * + + +class Foo: + def __init__(self): + pass + + def bar(self): + pass + + @property + def baz(self): + pass diff --git a/tests/roots/test-ext-autosummary-recursive/package2/__init__.py b/tests/roots/test-ext-autosummary-recursive/package2/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-autosummary-recursive/package2/module.py b/tests/roots/test-ext-autosummary-recursive/package2/module.py new file mode 100644 index 0000000..c76e733 --- /dev/null +++ b/tests/roots/test-ext-autosummary-recursive/package2/module.py @@ -0,0 +1,13 @@ +from os import * + + +class Foo: + def __init__(self): + pass + + def bar(self): + pass + + @property + def baz(self): + pass diff --git a/tests/roots/test-ext-autosummary-skip-member/conf.py b/tests/roots/test-ext-autosummary-skip-member/conf.py new file mode 100644 index 0000000..7c8f0e9 --- /dev/null +++ b/tests/roots/test-ext-autosummary-skip-member/conf.py @@ -0,0 +1,20 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autodoc_default_options = {'members': True} + + +def skip_member(app, what, name, obj, skip, options): + if name == 'skipmeth': + return True + elif name == '_privatemeth': + return False + + +def setup(app): + app.connect('autodoc-skip-member', skip_member) diff --git a/tests/roots/test-ext-autosummary-skip-member/index.rst b/tests/roots/test-ext-autosummary-skip-member/index.rst new file mode 100644 index 0000000..c376a13 --- /dev/null +++ b/tests/roots/test-ext-autosummary-skip-member/index.rst @@ -0,0 +1,4 @@ +.. autosummary:: + :toctree: generate + + target.Foo diff --git a/tests/roots/test-ext-autosummary-skip-member/target.py b/tests/roots/test-ext-autosummary-skip-member/target.py new file mode 100644 index 0000000..fdf557e --- /dev/null +++ b/tests/roots/test-ext-autosummary-skip-member/target.py @@ -0,0 +1,14 @@ +class Foo: + """docstring of Foo.""" + + def meth(self): + """docstring of meth.""" + pass + + def skipmeth(self): + """docstring of skipmeth.""" + pass + + def _privatemeth(self): + """docstring of _privatemeth.""" + pass diff --git a/tests/roots/test-ext-autosummary-template/_templates/empty.rst b/tests/roots/test-ext-autosummary-template/_templates/empty.rst new file mode 100644 index 0000000..7f7204c --- /dev/null +++ b/tests/roots/test-ext-autosummary-template/_templates/empty.rst @@ -0,0 +1 @@ +EMPTY diff --git a/tests/roots/test-ext-autosummary-template/conf.py b/tests/roots/test-ext-autosummary-template/conf.py new file mode 100644 index 0000000..cc23635 --- /dev/null +++ b/tests/roots/test-ext-autosummary-template/conf.py @@ -0,0 +1,10 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True +autodoc_default_options = {'members': True} +templates_path = ['_templates'] diff --git a/tests/roots/test-ext-autosummary-template/index.rst b/tests/roots/test-ext-autosummary-template/index.rst new file mode 100644 index 0000000..c9f28b0 --- /dev/null +++ b/tests/roots/test-ext-autosummary-template/index.rst @@ -0,0 +1,5 @@ +.. autosummary:: + :toctree: generate + :template: empty.rst + + target.Foo diff --git a/tests/roots/test-ext-autosummary-template/target.py b/tests/roots/test-ext-autosummary-template/target.py new file mode 100644 index 0000000..c607b59 --- /dev/null +++ b/tests/roots/test-ext-autosummary-template/target.py @@ -0,0 +1,2 @@ +class Foo: + """docstring of Foo.""" diff --git a/tests/roots/test-ext-autosummary/autosummary_class_module.py b/tests/roots/test-ext-autosummary/autosummary_class_module.py new file mode 100644 index 0000000..f13de17 --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_class_module.py @@ -0,0 +1,2 @@ +class Class(): + pass diff --git a/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py b/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py new file mode 100644 index 0000000..2b3d2da --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_dummy_inherited_module.py @@ -0,0 +1,13 @@ +from autosummary_dummy_module import Foo + + +class InheritedAttrClass(Foo): + + def __init__(self): + #: other docstring + self.subclassattr = "subclassattr" + + super().__init__() + + +__all__ = ["InheritedAttrClass"] diff --git a/tests/roots/test-ext-autosummary/autosummary_dummy_module.py b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py new file mode 100644 index 0000000..2d8829a --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_dummy_module.py @@ -0,0 +1,68 @@ +from os import path +from typing import Union + +from autosummary_class_module import Class + +__all__ = [ + "CONSTANT1", + "Exc", + "Foo", + "_Baz", + "bar", + "qux", + "path", +] + +#: module variable +CONSTANT1 = None +CONSTANT2 = None + + +class Foo: + #: class variable + CONSTANT3 = None + CONSTANT4 = None + + class Bar: + pass + + def __init__(self): + #: docstring + self.value = 1 + + def bar(self): + pass + + @property + def baz(self): + pass + + +class _Baz: + pass + + +def bar(x: Union[int, str], y: int = 1) -> None: + pass + + +def _quux(): + pass + + +class Exc(Exception): + pass + + +class _Exc(Exception): + pass + + +#: a module-level attribute +qux = 2 +#: a module-level attribute that has been excluded from __all__ +quuz = 2 + +considered_as_imported = Class() +non_imported_member = Class() +""" This attribute has a docstring, so it is recognized as a not-imported member """ diff --git a/tests/roots/test-ext-autosummary/autosummary_importfail.py b/tests/roots/test-ext-autosummary/autosummary_importfail.py new file mode 100644 index 0000000..5c6ce56 --- /dev/null +++ b/tests/roots/test-ext-autosummary/autosummary_importfail.py @@ -0,0 +1,2 @@ +# Fail module import in a catastrophic way +raise SystemExit(1) diff --git a/tests/roots/test-ext-autosummary/conf.py b/tests/roots/test-ext-autosummary/conf.py new file mode 100644 index 0000000..55c769c --- /dev/null +++ b/tests/roots/test-ext-autosummary/conf.py @@ -0,0 +1,10 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autosummary'] +autosummary_generate = True + +# The suffix of source filenames. +source_suffix = '.rst' diff --git a/tests/roots/test-ext-autosummary/index.rst b/tests/roots/test-ext-autosummary/index.rst new file mode 100644 index 0000000..08bd0f0 --- /dev/null +++ b/tests/roots/test-ext-autosummary/index.rst @@ -0,0 +1,18 @@ + +:autolink:`autosummary_dummy_module.Foo` + +:autolink:`autosummary_importfail` + +.. autosummary:: + :toctree: generated + :caption: An autosummary + + autosummary_dummy_module + autosummary_dummy_module.Foo + autosummary_dummy_module.Foo.Bar + autosummary_dummy_module.Foo.value + autosummary_dummy_module.bar + autosummary_dummy_module.qux + autosummary_dummy_inherited_module.InheritedAttrClass + autosummary_dummy_inherited_module.InheritedAttrClass.subclassattr + autosummary_importfail diff --git a/tests/roots/test-ext-coverage/conf.py b/tests/roots/test-ext-coverage/conf.py new file mode 100644 index 0000000..d3ec6e8 --- /dev/null +++ b/tests/roots/test-ext-coverage/conf.py @@ -0,0 +1,12 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage'] + +coverage_ignore_pyobjects = [ + r'^coverage_ignored(\..*)?$', + r'\.Ignored$', + r'\.Documented\.ignored\d$', +] diff --git a/tests/roots/test-ext-coverage/coverage_ignored.py b/tests/roots/test-ext-coverage/coverage_ignored.py new file mode 100644 index 0000000..b762955 --- /dev/null +++ b/tests/roots/test-ext-coverage/coverage_ignored.py @@ -0,0 +1,22 @@ +class Documented: + """Documented""" + + def ignored1(self): + pass + + def ignored2(self): + pass + + def not_ignored1(self): + pass + + def not_ignored2(self): + pass + + +class Ignored: + pass + + +class NotIgnored: + pass diff --git a/tests/roots/test-ext-coverage/coverage_not_ignored.py b/tests/roots/test-ext-coverage/coverage_not_ignored.py new file mode 100644 index 0000000..b762955 --- /dev/null +++ b/tests/roots/test-ext-coverage/coverage_not_ignored.py @@ -0,0 +1,22 @@ +class Documented: + """Documented""" + + def ignored1(self): + pass + + def ignored2(self): + pass + + def not_ignored1(self): + pass + + def not_ignored2(self): + pass + + +class Ignored: + pass + + +class NotIgnored: + pass diff --git a/tests/roots/test-ext-coverage/index.rst b/tests/roots/test-ext-coverage/index.rst new file mode 100644 index 0000000..b846898 --- /dev/null +++ b/tests/roots/test-ext-coverage/index.rst @@ -0,0 +1,6 @@ +.. automodule:: coverage_ignored + :members: + + +.. automodule:: coverage_not_ignored + :members: diff --git a/tests/roots/test-ext-doctest-skipif/conf.py b/tests/roots/test-ext-doctest-skipif/conf.py new file mode 100644 index 0000000..6f54982 --- /dev/null +++ b/tests/roots/test-ext-doctest-skipif/conf.py @@ -0,0 +1,16 @@ +extensions = ['sphinx.ext.doctest'] + +project = 'test project for the doctest :skipif: directive' +root_doc = 'skipif' +source_suffix = '.txt' +exclude_patterns = ['_build'] + +doctest_global_setup = ''' +from tests.test_ext_doctest import record + +record('doctest_global_setup', 'body', True) +''' + +doctest_global_cleanup = ''' +record('doctest_global_cleanup', 'body', True) +''' diff --git a/tests/roots/test-ext-doctest-skipif/skipif.txt b/tests/roots/test-ext-doctest-skipif/skipif.txt new file mode 100644 index 0000000..c5bd398 --- /dev/null +++ b/tests/roots/test-ext-doctest-skipif/skipif.txt @@ -0,0 +1,81 @@ +Testing the doctest extension's `:skipif:` option +================================================= + +testsetup +--------- + +.. testsetup:: group-skipif + :skipif: record('testsetup', ':skipif:', True) != 'this will be True' + + record('testsetup', 'body', True) + +.. testsetup:: group-skipif + :skipif: record('testsetup', ':skipif:', False) == 'this will be False' + + record('testsetup', 'body', False) + + +doctest +------- +.. doctest:: group-skipif + :skipif: record('doctest', ':skipif:', True) != 'this will be True' + + >>> print(record('doctest', 'body', True)) + The test is skipped, and this expected text is ignored + + +.. doctest:: + :skipif: record('doctest', ':skipif:', False) == 'this will be False' + + >>> print(record('doctest', 'body', False)) + Recorded doctest body False + + +testcode and testoutput +----------------------- + +testcode skipped +~~~~~~~~~~~~~~~~ + +.. testcode:: group-skipif + :skipif: record('testcode', ':skipif:', True) != 'this will be True' + + print(record('testcode', 'body', True)) + +.. testoutput:: group-skipif + :skipif: record('testoutput-1', ':skipif:', True) != 'this will be True' + + The previous testcode is skipped, and the :skipif: condition is True, + so this testoutput is ignored + +testcode executed +~~~~~~~~~~~~~~~~~ + +.. testcode:: group-skipif + :skipif: record('testcode', ':skipif:', False) == 'this will be False' + + print(record('testcode', 'body', False)) + +.. testoutput:: group-skipif + :skipif: record('testoutput-2', ':skipif:', False) == 'this will be False' + + Recorded testcode body False + +.. testoutput:: group-skipif + :skipif: record('testoutput-2', ':skipif:', True) != 'this will be True' + + The :skipif: condition is False, so this testoutput is ignored + + +testcleanup +----------- + +.. testcleanup:: group-skipif + :skipif: record('testcleanup', ':skipif:', True) != 'this will be True' + + record('testcleanup', 'body', True) + +.. testcleanup:: group-skipif + :skipif: record('testcleanup', ':skipif:', False) == 'this will be False' + + record('testcleanup', 'body', False) diff --git a/tests/roots/test-ext-doctest-with-autodoc/conf.py b/tests/roots/test-ext-doctest-with-autodoc/conf.py new file mode 100644 index 0000000..1ec1dd9 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/conf.py @@ -0,0 +1,7 @@ +import sys +from os import path + +sys.path.insert(0, path.abspath(path.dirname(__file__))) + +project = 'test project for doctest + autodoc reporting' +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest'] diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py b/tests/roots/test-ext-doctest-with-autodoc/dir/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py b/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py new file mode 100644 index 0000000..122fdf7 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/dir/bar.py @@ -0,0 +1,4 @@ +""" +>>> 'dir/bar.py:2' + +""" diff --git a/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst b/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst new file mode 100644 index 0000000..b2ee47f --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/dir/inner.rst @@ -0,0 +1,4 @@ +>>> 'dir/inner.rst:1' + +.. automodule:: dir.bar + :members: diff --git a/tests/roots/test-ext-doctest-with-autodoc/foo.py b/tests/roots/test-ext-doctest-with-autodoc/foo.py new file mode 100644 index 0000000..9f62a19 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/foo.py @@ -0,0 +1,5 @@ +""" + +>>> 'foo.py:3' + +""" diff --git a/tests/roots/test-ext-doctest-with-autodoc/index.rst b/tests/roots/test-ext-doctest-with-autodoc/index.rst new file mode 100644 index 0000000..09d1239 --- /dev/null +++ b/tests/roots/test-ext-doctest-with-autodoc/index.rst @@ -0,0 +1,4 @@ +.. automodule:: foo + :members: + +>>> 'index.rst:4' diff --git a/tests/roots/test-ext-doctest/conf.py b/tests/roots/test-ext-doctest/conf.py new file mode 100644 index 0000000..d0e8b10 --- /dev/null +++ b/tests/roots/test-ext-doctest/conf.py @@ -0,0 +1,6 @@ +extensions = ['sphinx.ext.doctest'] + +project = 'test project for doctest' +root_doc = 'doctest' +source_suffix = '.txt' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-ext-doctest/doctest.txt b/tests/roots/test-ext-doctest/doctest.txt new file mode 100644 index 0000000..04780cf --- /dev/null +++ b/tests/roots/test-ext-doctest/doctest.txt @@ -0,0 +1,163 @@ +Testing the doctest extension +============================= + +Simple doctest blocks +--------------------- + +>>> 1+1 +2 +>>> 1/0 +Traceback (most recent call last): + ... +ZeroDivisionError: integer division or modulo by zero + + +Special directives +------------------ + +* doctest + + .. doctest:: + + >>> 1+1 + 2 + >>> 1/0 + Traceback (most recent call last): + ... + ZeroDivisionError: integer division or modulo by zero + +* testcode/testoutput + + .. testcode:: + + print(1+1) + + .. testoutput:: + + 2 + + .. testcode:: + + 1/0 + + .. testoutput:: + + Traceback (most recent call last): + ... + ZeroDivisionError: integer division or modulo by zero + +* testsetup + + .. testsetup:: * + + def squared(x): + return x * x + + .. doctest:: + + >>> squared(2) + 4 + + .. testcode:: + + print(squared(2)) + + .. testoutput:: + + 4 + + >>> squared(2) + 4 + +* options for doctest/testcode/testoutput blocks + + .. testcode:: + :hide: + + print('Output text.') + + .. testoutput:: + :hide: + :options: +NORMALIZE_WHITESPACE + + Output text. + + .. doctest:: + :pyversion: >= 2.0 + + >>> a = 3 + >>> a + 3 + + .. doctest:: + :pyversion: < 2.0 + + >>> a = 3 + >>> a + 4 + +* grouping + + .. testsetup:: group1 + + def add(x, y): + return x + y + + + ``add`` is now known in "group1", but not in others. + + .. doctest:: group1 + + >>> add(1, 1) + 2 + + .. doctest:: group2 + + >>> add(1, 1) + Traceback (most recent call last): + ... + NameError: name 'add' is not defined + + Interleaving testcode/testoutput: + + .. testcode:: group1 + + print(squared(3)) + + .. testcode:: group2 + + print(squared(4)) + + .. testoutput:: group1 + + 9 + + .. testoutput:: group2 + + 16 + + +.. testcleanup:: * + + from tests import test_ext_doctest + test_ext_doctest.cleanup_call() + +non-ASCII result +---------------- + +>>> print('umlauts: äöü.') +umlauts: äöü. +>>> print('Japanese: 日本語') +Japanese: 日本語 + +keep control char in raw string +------------------------------- + +.. doctest:: + + >>> print('one\ntwo') + one + two + >>> print(r'one\ntwo') + one\ntwo + diff --git a/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py new file mode 100644 index 0000000..f463449 --- /dev/null +++ b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py @@ -0,0 +1,6 @@ +extensions = ['sphinx.ext.extlinks'] +extlinks = { + 'user': ('https://github.com/%s', '@%s'), + 'repo': ('https://github.com/%s', 'project %s'), +} +extlinks_detect_hardcoded_links = True diff --git a/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/index.rst b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/index.rst new file mode 100644 index 0000000..162b361 --- /dev/null +++ b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/index.rst @@ -0,0 +1,24 @@ +test-ext-extlinks-hardcoded-urls +================================ + +.. Links generated by extlinks extension should not raise any warnings. +.. Only hardcoded URLs are affected. + +:user:`octocat` + +:repo:`sphinx-doc/sphinx` + +.. hardcoded replaceable link which can be replaced as +.. :repo:`octocat` or :user:`octocat` + +https://github.com/octocat + +`inline replaceable link `_ + +`replaceable link`_ + +`non replaceable link `_ + +.. hyperlinks + +.. _replaceable link: https://github.com/octocat diff --git a/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py b/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py new file mode 100644 index 0000000..db0b341 --- /dev/null +++ b/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py @@ -0,0 +1,3 @@ +extensions = ['sphinx.ext.extlinks'] +extlinks = {'issue': ('https://github.com/sphinx-doc/sphinx/issues/%s', 'issue %s')} +extlinks_detect_hardcoded_links = True diff --git a/tests/roots/test-ext-extlinks-hardcoded-urls/index.rst b/tests/roots/test-ext-extlinks-hardcoded-urls/index.rst new file mode 100644 index 0000000..ada6f07 --- /dev/null +++ b/tests/roots/test-ext-extlinks-hardcoded-urls/index.rst @@ -0,0 +1,28 @@ +test-ext-extlinks-hardcoded-urls +================================ + +.. Links generated by extlinks extension should not raise any warnings. +.. Only hardcoded URLs are affected. + +:issue:`1` + +.. hardcoded replaceable link + +https://github.com/sphinx-doc/sphinx/issues/1 + +`inline replaceable link `_ + +`replaceable link`_ + +.. hardcoded non-replaceable link + +https://github.com/sphinx-doc/sphinx/pulls/1 + +`inline non-replaceable link `_ + +`non-replaceable link`_ + +.. hyperlinks + +.. _replaceable link: https://github.com/sphinx-doc/sphinx/issues/1 +.. _non-replaceable link: https://github.com/sphinx-doc/sphinx/pulls/1 diff --git a/tests/roots/test-ext-githubpages/conf.py b/tests/roots/test-ext-githubpages/conf.py new file mode 100644 index 0000000..3577096 --- /dev/null +++ b/tests/roots/test-ext-githubpages/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.githubpages'] diff --git a/tests/roots/test-ext-githubpages/index.rst b/tests/roots/test-ext-githubpages/index.rst new file mode 100644 index 0000000..711847f --- /dev/null +++ b/tests/roots/test-ext-githubpages/index.rst @@ -0,0 +1,3 @@ +githubpages +=========== + diff --git a/tests/roots/test-ext-graphviz/_static/images/test.svg b/tests/roots/test-ext-graphviz/_static/images/test.svg new file mode 100644 index 0000000..6134f44 --- /dev/null +++ b/tests/roots/test-ext-graphviz/_static/images/test.svg @@ -0,0 +1,8 @@ + + + + + + diff --git a/tests/roots/test-ext-graphviz/conf.py b/tests/roots/test-ext-graphviz/conf.py new file mode 100644 index 0000000..317457f --- /dev/null +++ b/tests/roots/test-ext-graphviz/conf.py @@ -0,0 +1,3 @@ +extensions = ['sphinx.ext.graphviz'] +exclude_patterns = ['_build'] +html_static_path = ["_static"] diff --git a/tests/roots/test-ext-graphviz/graph.dot b/tests/roots/test-ext-graphviz/graph.dot new file mode 100644 index 0000000..ca57244 --- /dev/null +++ b/tests/roots/test-ext-graphviz/graph.dot @@ -0,0 +1,3 @@ +digraph { + bar -> baz +} diff --git a/tests/roots/test-ext-graphviz/graph.xx.dot b/tests/roots/test-ext-graphviz/graph.xx.dot new file mode 100644 index 0000000..e5add5c --- /dev/null +++ b/tests/roots/test-ext-graphviz/graph.xx.dot @@ -0,0 +1,3 @@ +digraph { + BAR -> BAZ +} diff --git a/tests/roots/test-ext-graphviz/index.rst b/tests/roots/test-ext-graphviz/index.rst new file mode 100644 index 0000000..cb0f069 --- /dev/null +++ b/tests/roots/test-ext-graphviz/index.rst @@ -0,0 +1,43 @@ +graphviz +======== + +.. digraph:: foo + :caption: caption of graph + + bar -> baz + +.. |graph| digraph:: bar + + bar -> baz + +Hello |graph| graphviz world + +.. digraph:: foo + :graphviz_dot: neato + :class: neato_graph + + baz -> qux + + +.. graphviz:: graph.dot + +.. digraph:: bar + :align: right + :caption: on *right* + + foo -> bar + +.. digraph:: foo + :align: center + + centered + +.. graphviz:: + :align: center + + digraph test { + foo [label="foo", URL="#graphviz", target="_parent"] + bar [label="bar", image="./_static/images/test.svg"] + baz [label="baz", URL="./_static/images/test.svg"] + foo -> bar -> baz + } diff --git a/tests/roots/test-ext-ifconfig/conf.py b/tests/roots/test-ext-ifconfig/conf.py new file mode 100644 index 0000000..e82ec79 --- /dev/null +++ b/tests/roots/test-ext-ifconfig/conf.py @@ -0,0 +1,10 @@ +extensions = ['sphinx.ext.ifconfig'] +exclude_patterns = ['_build'] + +confval1 = True + + +def setup(app): + app.add_config_value('confval1', False, None) + app.add_config_value('confval2', False, None) + app.add_config_value('false_config', False, None) diff --git a/tests/roots/test-ext-ifconfig/index.rst b/tests/roots/test-ext-ifconfig/index.rst new file mode 100644 index 0000000..f7fabcc --- /dev/null +++ b/tests/roots/test-ext-ifconfig/index.rst @@ -0,0 +1,21 @@ +ifconfig +======== + +.. ifconfig:: confval1 + + spam + +.. ifconfig:: confval2 + + egg + +Issue 10496 regression test +=========================== + +.. ifconfig:: false_config + + `Link 1 `__ + +.. ifconfig:: false_config + + `Link 2 `__ diff --git a/tests/roots/test-ext-imgconverter/conf.py b/tests/roots/test-ext-imgconverter/conf.py new file mode 100644 index 0000000..6a2e75d --- /dev/null +++ b/tests/roots/test-ext-imgconverter/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.imgconverter'] diff --git a/tests/roots/test-ext-imgconverter/img.pdf b/tests/roots/test-ext-imgconverter/img.pdf new file mode 100644 index 0000000..cacbd85 Binary files /dev/null and b/tests/roots/test-ext-imgconverter/img.pdf differ diff --git a/tests/roots/test-ext-imgconverter/index.rst b/tests/roots/test-ext-imgconverter/index.rst new file mode 100644 index 0000000..f8ef1d6 --- /dev/null +++ b/tests/roots/test-ext-imgconverter/index.rst @@ -0,0 +1,5 @@ +test-ext-imgconverter +===================== + +.. image:: svgimg.svg +.. image:: img.pdf diff --git a/tests/roots/test-ext-imgconverter/svgimg.svg b/tests/roots/test-ext-imgconverter/svgimg.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-ext-imgconverter/svgimg.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/roots/test-ext-imgmockconverter/1/svgimg.svg b/tests/roots/test-ext-imgmockconverter/1/svgimg.svg new file mode 100644 index 0000000..981e301 --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/1/svgimg.svg @@ -0,0 +1,3 @@ + + + diff --git a/tests/roots/test-ext-imgmockconverter/2/svgimg.svg b/tests/roots/test-ext-imgmockconverter/2/svgimg.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/2/svgimg.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/roots/test-ext-imgmockconverter/conf.py b/tests/roots/test-ext-imgmockconverter/conf.py new file mode 100644 index 0000000..679bb5a --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/conf.py @@ -0,0 +1,5 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) +extensions = ['mocksvgconverter'] diff --git a/tests/roots/test-ext-imgmockconverter/index.rst b/tests/roots/test-ext-imgmockconverter/index.rst new file mode 100644 index 0000000..bc665f6 --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/index.rst @@ -0,0 +1,6 @@ +test-ext-imgconverter +===================== + +.. image:: ./1/svgimg.svg +.. image:: ./2/svgimg.svg + diff --git a/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py b/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py new file mode 100644 index 0000000..43368de --- /dev/null +++ b/tests/roots/test-ext-imgmockconverter/mocksvgconverter.py @@ -0,0 +1,39 @@ +""" + Does foo.svg --> foo.pdf with no change to the file. +""" + +import shutil + +from sphinx.transforms.post_transforms.images import ImageConverter + +if False: + # For type annotation + from typing import Any, Dict # NOQA + + from sphinx.application import Sphinx # NOQA + +class MyConverter(ImageConverter): + conversion_rules = [ + ('image/svg+xml', 'application/pdf'), + ] + + def is_available(self): + # type: () -> bool + return True + + def convert(self, _from, _to): + # type: (unicode, unicode) -> bool + """Mock converts the image from SVG to PDF.""" + shutil.copyfile(_from, _to) + return True + + +def setup(app): + # type: (Sphinx) -> Dict[unicode, Any] + app.add_post_transform(MyConverter) + + return { + 'version': 'builtin', + 'parallel_read_safe': True, + 'parallel_write_safe': True, + } diff --git a/tests/roots/test-ext-inheritance_diagram/conf.py b/tests/roots/test-ext-inheritance_diagram/conf.py new file mode 100644 index 0000000..d3778d5 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/conf.py @@ -0,0 +1,6 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.inheritance_diagram', 'sphinx.ext.intersphinx'] diff --git a/tests/roots/test-ext-inheritance_diagram/example/__init__.py b/tests/roots/test-ext-inheritance_diagram/example/__init__.py new file mode 100644 index 0000000..2f85c08 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/example/__init__.py @@ -0,0 +1 @@ +# example.py diff --git a/tests/roots/test-ext-inheritance_diagram/example/sphinx.py b/tests/roots/test-ext-inheritance_diagram/example/sphinx.py new file mode 100644 index 0000000..2bfbf4c --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/example/sphinx.py @@ -0,0 +1,5 @@ +# example.sphinx + + +class DummyClass: + pass diff --git a/tests/roots/test-ext-inheritance_diagram/external/other.py b/tests/roots/test-ext-inheritance_diagram/external/other.py new file mode 100644 index 0000000..a4ce8a7 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/external/other.py @@ -0,0 +1,5 @@ +from test import Alice + + +class Bob(Alice): + pass diff --git a/tests/roots/test-ext-inheritance_diagram/index.rst b/tests/roots/test-ext-inheritance_diagram/index.rst new file mode 100644 index 0000000..e694fb0 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/index.rst @@ -0,0 +1,18 @@ +============================ +test-ext-inheritance_diagram +============================ + +.. inheritance-diagram:: test.Foo + +.. inheritance-diagram:: test.Foo + :caption: Test Foo! + +.. inheritance-diagram:: test.DocSubDir2 + +.. py:class:: test.DocHere + +.. py:class:: test.DocMainLevel + +.. inheritance-diagram:: external.other.Bob + +.. py:class:: test.Alice diff --git a/tests/roots/test-ext-inheritance_diagram/subdir/page1.rst b/tests/roots/test-ext-inheritance_diagram/subdir/page1.rst new file mode 100644 index 0000000..3001b02 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/subdir/page1.rst @@ -0,0 +1,9 @@ +================================================ +test-ext-inheritance_diagram subdirectory page 1 +================================================ + +.. inheritance-diagram:: test.DocMainLevel + +.. inheritance-diagram:: test.DocSubDir2 + +.. py:class:: test.DocSubDir1 diff --git a/tests/roots/test-ext-inheritance_diagram/subdir/page2.rst b/tests/roots/test-ext-inheritance_diagram/subdir/page2.rst new file mode 100644 index 0000000..720e2d8 --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/subdir/page2.rst @@ -0,0 +1,5 @@ +================================================ +test-ext-inheritance_diagram subdirectory page 2 +================================================ + +.. py:class:: test.DocSubDir2 diff --git a/tests/roots/test-ext-inheritance_diagram/test.py b/tests/roots/test-ext-inheritance_diagram/test.py new file mode 100644 index 0000000..efb1c2a --- /dev/null +++ b/tests/roots/test-ext-inheritance_diagram/test.py @@ -0,0 +1,22 @@ +class Foo: + pass + + +class DocHere(Foo): + pass + + +class DocSubDir1(DocHere): + pass + + +class DocSubDir2(DocSubDir1): + pass + + +class DocMainLevel(Foo): + pass + + +class Alice(object): + pass diff --git a/tests/roots/test-ext-intersphinx-cppdomain/conf.py b/tests/roots/test-ext-intersphinx-cppdomain/conf.py new file mode 100644 index 0000000..9485eb2 --- /dev/null +++ b/tests/roots/test-ext-intersphinx-cppdomain/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.intersphinx'] diff --git a/tests/roots/test-ext-intersphinx-cppdomain/index.rst b/tests/roots/test-ext-intersphinx-cppdomain/index.rst new file mode 100644 index 0000000..bf67d52 --- /dev/null +++ b/tests/roots/test-ext-intersphinx-cppdomain/index.rst @@ -0,0 +1,8 @@ +test-ext-intersphinx-cppdomain +============================== + +.. cpp:namespace:: foo + +:cpp:class:`Bar` + +.. cpp:function:: foons::bartype FooBarBaz() diff --git a/tests/roots/test-ext-intersphinx-role/conf.py b/tests/roots/test-ext-intersphinx-role/conf.py new file mode 100644 index 0000000..a54f5c2 --- /dev/null +++ b/tests/roots/test-ext-intersphinx-role/conf.py @@ -0,0 +1,3 @@ +extensions = ['sphinx.ext.intersphinx'] +# the role should not honor this conf var +intersphinx_disabled_reftypes = ['*'] diff --git a/tests/roots/test-ext-intersphinx-role/index.rst b/tests/roots/test-ext-intersphinx-role/index.rst new file mode 100644 index 0000000..58edb7a --- /dev/null +++ b/tests/roots/test-ext-intersphinx-role/index.rst @@ -0,0 +1,44 @@ +- ``module1`` is only defined in ``inv``: + :external:py:mod:`module1` + +.. py:module:: module2 + +- ``module2`` is defined here and also in ``inv``, but should resolve to inv: + :external:py:mod:`module2` + +- ``module3`` is not defined anywhere, so should warn: + :external:py:mod:`module3` + +.. py:module:: module10 + +- ``module10`` is only defined here, but should still not be resolved to: + :external:py:mod:`module10` + +- a function in inv: + :external:py:func:`module1.func` +- a method, but with old style inventory prefix, which shouldn't work: + :external:py:meth:`inv:Foo.bar` +- a non-existing role: + :external:py:nope:`something` + +.. default-domain:: cpp + +- a type where the default domain is used to find the role: + :external:type:`std::uint8_t` +- a non-existing role in default domain: + :external:nope:`somethingElse` + +- two roles in ``std`` which can be found without a default domain: + + - :external:doc:`docname` + - :external:option:`ls -l` + + +- a function with explicit inventory: + :external+inv:c:func:`CFunc` +- a class with explicit non-existing inventory, which also has upper-case in name: + :external+invNope:cpp:class:`foo::Bar` + + +- explicit title: + :external:cpp:type:`FoonsTitle ` diff --git a/tests/roots/test-ext-math-compat/conf.py b/tests/roots/test-ext-math-compat/conf.py new file mode 100644 index 0000000..85e3950 --- /dev/null +++ b/tests/roots/test-ext-math-compat/conf.py @@ -0,0 +1,20 @@ +from docutils import nodes +from docutils.parsers.rst import Directive + +extensions = ['sphinx.ext.mathjax'] + + +def my_math_role(role, rawtext, text, lineno, inliner, options={}, content=[]): + text = 'E = mc^2' + return [nodes.math(text, text)], [] + + +class MyMathDirective(Directive): + def run(self): + text = 'E = mc^2' + return [nodes.math_block(text, text)] + + +def setup(app): + app.add_role('my_math', my_math_role) + app.add_directive('my-math', MyMathDirective) diff --git a/tests/roots/test-ext-math-compat/index.rst b/tests/roots/test-ext-math-compat/index.rst new file mode 100644 index 0000000..208878c --- /dev/null +++ b/tests/roots/test-ext-math-compat/index.rst @@ -0,0 +1,21 @@ +Test Math +========= + +inline +------ + +Inline: :math:`E=mc^2` +Inline my math: :my_math:`:-)` + +block +----- + +.. math:: a^2+b^2=c^2 + +Second math + +.. math:: e^{i\pi}+1=0 + +Multi math equations + +.. my-math:: diff --git a/tests/roots/test-ext-math-simple/conf.py b/tests/roots/test-ext-math-simple/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-math-simple/index.rst b/tests/roots/test-ext-math-simple/index.rst new file mode 100644 index 0000000..a455d89 --- /dev/null +++ b/tests/roots/test-ext-math-simple/index.rst @@ -0,0 +1,4 @@ +Test Math +========= + +.. math:: a^2+b^2=c^2 diff --git a/tests/roots/test-ext-math/conf.py b/tests/roots/test-ext-math/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-math/index.rst b/tests/roots/test-ext-math/index.rst new file mode 100644 index 0000000..221284a --- /dev/null +++ b/tests/roots/test-ext-math/index.rst @@ -0,0 +1,25 @@ +Test Math +========= + +.. toctree:: + :numbered: 1 + + math + page + nomath + +.. math:: a^2+b^2=c^2 + +Inline :math:`E=mc^2` + +Second math + +.. math:: e^{i\pi}+1=0 + +Multi math equations + +.. math:: + + S &= \pi r^2 + + V &= \frac{4}{3} \pi r^3 diff --git a/tests/roots/test-ext-math/math.rst b/tests/roots/test-ext-math/math.rst new file mode 100644 index 0000000..c05c3a0 --- /dev/null +++ b/tests/roots/test-ext-math/math.rst @@ -0,0 +1,31 @@ +Test math extensions :math:`E = m c^2` +====================================== + +This is inline math: :math:`a^2 + b^2 = c^2`. + +.. math:: a^2 + b^2 = c^2 + +.. math:: + + a + 1 < b + +.. math:: + :label: foo + + e^{i\pi} = 1 + +.. math:: + :label: + + e^{ix} = \cos x + i\sin x + +.. math:: + + n \in \mathbb N + +.. math:: + :nowrap: + + a + 1 < b + +Referencing equation :eq:`foo` and :math:numref:`foo`. diff --git a/tests/roots/test-ext-math/nomath.rst b/tests/roots/test-ext-math/nomath.rst new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-math/page.rst b/tests/roots/test-ext-math/page.rst new file mode 100644 index 0000000..ef80409 --- /dev/null +++ b/tests/roots/test-ext-math/page.rst @@ -0,0 +1,9 @@ +Test multiple pages +=================== + +.. math:: + :label: bar + + a = b + 1 + +Referencing equations :eq:`foo` and :eq:`bar`. diff --git a/tests/roots/test-ext-napoleon/conf.py b/tests/roots/test-ext-napoleon/conf.py new file mode 100644 index 0000000..502fb5a --- /dev/null +++ b/tests/roots/test-ext-napoleon/conf.py @@ -0,0 +1,5 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) +extensions = ['sphinx.ext.napoleon'] diff --git a/tests/roots/test-ext-napoleon/index.rst b/tests/roots/test-ext-napoleon/index.rst new file mode 100644 index 0000000..4c013b7 --- /dev/null +++ b/tests/roots/test-ext-napoleon/index.rst @@ -0,0 +1,6 @@ +test-ext-napoleon +================= + +.. toctree:: + + typehints diff --git a/tests/roots/test-ext-napoleon/mypackage/__init__.py b/tests/roots/test-ext-napoleon/mypackage/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-ext-napoleon/mypackage/typehints.py b/tests/roots/test-ext-napoleon/mypackage/typehints.py new file mode 100644 index 0000000..526b78e --- /dev/null +++ b/tests/roots/test-ext-napoleon/mypackage/typehints.py @@ -0,0 +1,11 @@ +def hello(x: int, *args: int, **kwargs: int) -> None: + """ + Parameters + ---------- + x + X + *args + Additional arguments. + **kwargs + Extra arguments. + """ diff --git a/tests/roots/test-ext-napoleon/typehints.rst b/tests/roots/test-ext-napoleon/typehints.rst new file mode 100644 index 0000000..43c61f6 --- /dev/null +++ b/tests/roots/test-ext-napoleon/typehints.rst @@ -0,0 +1,5 @@ +typehints +========= + +.. automodule:: mypackage.typehints + :members: diff --git a/tests/roots/test-ext-todo/bar.rst b/tests/roots/test-ext-todo/bar.rst new file mode 100644 index 0000000..6804a68 --- /dev/null +++ b/tests/roots/test-ext-todo/bar.rst @@ -0,0 +1,4 @@ +bar +=== + +.. todo:: todo in bar diff --git a/tests/roots/test-ext-todo/conf.py b/tests/roots/test-ext-todo/conf.py new file mode 100644 index 0000000..64b749e --- /dev/null +++ b/tests/roots/test-ext-todo/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.todo'] diff --git a/tests/roots/test-ext-todo/foo.rst b/tests/roots/test-ext-todo/foo.rst new file mode 100644 index 0000000..12e9f63 --- /dev/null +++ b/tests/roots/test-ext-todo/foo.rst @@ -0,0 +1,10 @@ +foo +=== + +.. todo:: todo in foo + +.. py:function:: hello() + + :param bug: #5800 + + .. todo:: todo in param field diff --git a/tests/roots/test-ext-todo/index.rst b/tests/roots/test-ext-todo/index.rst new file mode 100644 index 0000000..781473d --- /dev/null +++ b/tests/roots/test-ext-todo/index.rst @@ -0,0 +1,11 @@ +test for sphinx.ext.todo +======================== + +.. toctree:: + + foo + bar + +.. todolist:: + +.. todolist:: diff --git a/tests/roots/test-ext-viewcode-find/conf.py b/tests/roots/test-ext-viewcode-find/conf.py new file mode 100644 index 0000000..18f97f4 --- /dev/null +++ b/tests/roots/test-ext-viewcode-find/conf.py @@ -0,0 +1,3 @@ +extensions = ['sphinx.ext.viewcode'] +exclude_patterns = ['_build'] +viewcode_follow_imported_members = False diff --git a/tests/roots/test-ext-viewcode-find/index.rst b/tests/roots/test-ext-viewcode-find/index.rst new file mode 100644 index 0000000..7eb416a --- /dev/null +++ b/tests/roots/test-ext-viewcode-find/index.rst @@ -0,0 +1,38 @@ +viewcode +======== + +.. py:module:: not_a_package + +.. py:function:: func1(a, b) + + This is func1 + +.. py:function:: not_a_package.submodule.func1(a, b) + + This is func1 + +.. py:module:: not_a_package.submodule + +.. py:class:: Class1 + + This is Class1 + +.. py:class:: Class3 + + This is Class3 + +.. py:class:: not_a_package.submodule.Class1 + + This is Class1 + +.. literalinclude:: not_a_package/__init__.py + :language: python + :pyobject: func1 + +.. literalinclude:: not_a_package/submodule.py + :language: python + :pyobject: func1 + +.. py:attribute:: not_a_package.submodule.Class3.class_attr + + This is the class attribute class_attr diff --git a/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py b/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py new file mode 100644 index 0000000..2382935 --- /dev/null +++ b/tests/roots/test-ext-viewcode-find/not_a_package/__init__.py @@ -0,0 +1 @@ +from .submodule import Class1, func1 diff --git a/tests/roots/test-ext-viewcode-find/not_a_package/submodule.py b/tests/roots/test-ext-viewcode-find/not_a_package/submodule.py new file mode 100644 index 0000000..ba8be78 --- /dev/null +++ b/tests/roots/test-ext-viewcode-find/not_a_package/submodule.py @@ -0,0 +1,31 @@ +""" +submodule +""" +raise RuntimeError('This module should not get imported') + + +def decorator(f): + return f + + +@decorator +def func1(a, b): + """ + this is func1 + """ + return a, b + + +@decorator +class Class1: + """ + this is Class1 + """ + + +class Class3: + """ + this is Class3 + """ + class_attr = 42 + """this is the class attribute class_attr""" diff --git a/tests/roots/test-ext-viewcode/conf.py b/tests/roots/test-ext-viewcode/conf.py new file mode 100644 index 0000000..5e07214 --- /dev/null +++ b/tests/roots/test-ext-viewcode/conf.py @@ -0,0 +1,24 @@ +import os +import sys + +source_dir = os.path.abspath('.') +if source_dir not in sys.path: + sys.path.insert(0, source_dir) +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] +exclude_patterns = ['_build'] + + +if 'test_linkcode' in tags: + extensions.remove('sphinx.ext.viewcode') + extensions.append('sphinx.ext.linkcode') + + def linkcode_resolve(domain, info): + if domain == 'py': + fn = info['module'].replace('.', '/') + return "http://foobar/source/%s.py" % fn + elif domain == "js": + return "http://foobar/js/" + info['fullname'] + elif domain in ("c", "cpp"): + return f"http://foobar/{domain}/{''.join(info['names'])}" + else: + raise AssertionError() diff --git a/tests/roots/test-ext-viewcode/index.rst b/tests/roots/test-ext-viewcode/index.rst new file mode 100644 index 0000000..e7956e7 --- /dev/null +++ b/tests/roots/test-ext-viewcode/index.rst @@ -0,0 +1,39 @@ +viewcode +======== + +.. py:module:: spam + +.. autofunction:: func1 + +.. autofunction:: func2 + +.. autofunction:: spam.mod1.func1 + +.. autofunction:: spam.mod2.func2 + +.. autofunction:: Class1 + +.. autofunction:: Class2 + +.. autofunction:: spam.mod1.Class1 + +.. autofunction:: spam.mod2.Class2 + + +.. literalinclude:: spam/__init__.py + :language: python + :pyobject: func1 + +.. literalinclude:: spam/mod1.py + :language: python + :pyobject: func1 + +.. autoclass:: spam.mod3.Class3 + :members: + +.. automodule:: spam.mod3 + :members: + +.. toctree:: + + objects diff --git a/tests/roots/test-ext-viewcode/objects.rst b/tests/roots/test-ext-viewcode/objects.rst new file mode 100644 index 0000000..114adbf --- /dev/null +++ b/tests/roots/test-ext-viewcode/objects.rst @@ -0,0 +1,169 @@ +Testing object descriptions +=========================== + +.. function:: func_without_module(a, b, *c[, d]) + + Does something. + +.. function:: func_without_body() + +.. function:: func_noindex + :no-index: + +.. function:: func_with_module + :module: foolib + +Referring to :func:`func with no index `. +Referring to :func:`nothing <>`. + +.. module:: mod + :synopsis: Module synopsis. + :platform: UNIX + +.. function:: func_in_module + +.. class:: Cls + + .. method:: meth1 + + .. staticmethod:: meths + + .. attribute:: attr + +.. explicit class given +.. method:: Cls.meth2 + +.. explicit module given +.. exception:: Error(arg1, arg2) + :module: errmod + +.. data:: var + + +.. currentmodule:: None + +.. function:: func_without_module2() -> annotation + +.. object:: long(parameter, \ + list) + another one + +.. class:: TimeInt + + Has only one parameter (triggers special behavior...) + + :param moo: |test| + :type moo: |test| + +.. |test| replace:: Moo + +.. class:: Time(hour, minute, isdst) + + :param year: The year. + :type year: TimeInt + :param TimeInt minute: The minute. + :param isdst: whether it's DST + :type isdst: * some complex + * expression + :returns: a new :class:`Time` instance + :rtype: :class:`Time` + :raises ValueError: if the values are out of range + :ivar int hour: like *hour* + :ivar minute: like *minute* + :vartype minute: int + :param hour: Some parameter + :type hour: DuplicateType + :param hour: Duplicate param. Should not lead to crashes. + :type hour: DuplicateType + :param .Cls extcls: A class from another module. + + +C items +======= + +.. c:function:: Sphinx_DoSomething() + +.. c:member:: SphinxStruct.member + +.. c:macro:: SPHINX_USE_PYTHON + +.. c:type:: SphinxType + +.. c:var:: sphinx_global + + +Javascript items +================ + +.. js:function:: foo() + +.. js:data:: bar + +.. documenting the method of any object +.. js:function:: bar.baz(href, callback[, errback]) + + :param string href: The location of the resource. + :param callback: Gets called with the data returned by the resource. + :throws InvalidHref: If the `href` is invalid. + :returns: `undefined` + +.. js:attribute:: bar.spam + +References +========== + +Referencing :class:`mod.Cls` or :Class:`mod.Cls` should be the same. + +With target: :c:func:`Sphinx_DoSomething()` (parentheses are handled), +:c:member:`SphinxStruct.member`, :c:macro:`SPHINX_USE_PYTHON`, +:c:type:`SphinxType *` (pointer is handled), :c:data:`sphinx_global`. + +Without target: :c:func:`CFunction`. :c:func:`!malloc`. + +:js:func:`foo()` +:js:func:`foo` + +:js:data:`bar` +:js:func:`bar.baz()` +:js:func:`bar.baz` +:js:func:`~bar.baz()` + +:js:attr:`bar.baz` + + +Others +====== + +.. envvar:: HOME + +.. program:: python + +.. cmdoption:: -c command + +.. program:: perl + +.. cmdoption:: -c + +.. option:: +p + +Link to :option:`perl +p`. + + +User markup +=========== + +.. userdesc:: myobj:parameter + + Description of userdesc. + + +Referencing :userdescrole:`myobj`. + + +CPP domain +========== + +.. cpp:class:: n::Array + + .. cpp:function:: T& operator[]( unsigned j ) + const T& operator[]( unsigned j ) const diff --git a/tests/roots/test-ext-viewcode/spam/__init__.py b/tests/roots/test-ext-viewcode/spam/__init__.py new file mode 100644 index 0000000..6219042 --- /dev/null +++ b/tests/roots/test-ext-viewcode/spam/__init__.py @@ -0,0 +1,2 @@ +from .mod1 import Class1, func1 +from .mod2 import Class2, func2 diff --git a/tests/roots/test-ext-viewcode/spam/mod1.py b/tests/roots/test-ext-viewcode/spam/mod1.py new file mode 100644 index 0000000..a078328 --- /dev/null +++ b/tests/roots/test-ext-viewcode/spam/mod1.py @@ -0,0 +1,30 @@ +""" +mod1 +""" + + +def decorator(f): + return f + + +@decorator +def func1(a, b): + """ + this is func1 + """ + return a, b + + +@decorator +class Class1: + """ + this is Class1 + """ + + +class Class3: + """ + this is Class3 + """ + class_attr = 42 + """this is the class attribute class_attr""" diff --git a/tests/roots/test-ext-viewcode/spam/mod2.py b/tests/roots/test-ext-viewcode/spam/mod2.py new file mode 100644 index 0000000..72cb089 --- /dev/null +++ b/tests/roots/test-ext-viewcode/spam/mod2.py @@ -0,0 +1,22 @@ +""" +mod2 +""" + + +def decorator(f): + return f + + +@decorator +def func2(a, b): + """ + this is func2 + """ + return a, b + + +@decorator +class Class2: + """ + this is Class2 + """ diff --git a/tests/roots/test-ext-viewcode/spam/mod3.py b/tests/roots/test-ext-viewcode/spam/mod3.py new file mode 100644 index 0000000..812c9b5 --- /dev/null +++ b/tests/roots/test-ext-viewcode/spam/mod3.py @@ -0,0 +1,3 @@ +from spam.mod1 import Class3 + +__all__ = ('Class3',) diff --git a/tests/roots/test-extensions/conf.py b/tests/roots/test-extensions/conf.py new file mode 100644 index 0000000..9a3cbc8 --- /dev/null +++ b/tests/roots/test-extensions/conf.py @@ -0,0 +1,4 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) diff --git a/tests/roots/test-extensions/read_parallel.py b/tests/roots/test-extensions/read_parallel.py new file mode 100644 index 0000000..a3e052f --- /dev/null +++ b/tests/roots/test-extensions/read_parallel.py @@ -0,0 +1,4 @@ +def setup(app): + return { + 'parallel_read_safe': True + } diff --git a/tests/roots/test-extensions/read_serial.py b/tests/roots/test-extensions/read_serial.py new file mode 100644 index 0000000..c55570a --- /dev/null +++ b/tests/roots/test-extensions/read_serial.py @@ -0,0 +1,4 @@ +def setup(app): + return { + 'parallel_read_safe': False + } diff --git a/tests/roots/test-extensions/write_parallel.py b/tests/roots/test-extensions/write_parallel.py new file mode 100644 index 0000000..ebc48ef --- /dev/null +++ b/tests/roots/test-extensions/write_parallel.py @@ -0,0 +1,4 @@ +def setup(app): + return { + 'parallel_write_safe': True, + } diff --git a/tests/roots/test-extensions/write_serial.py b/tests/roots/test-extensions/write_serial.py new file mode 100644 index 0000000..75494ce --- /dev/null +++ b/tests/roots/test-extensions/write_serial.py @@ -0,0 +1,4 @@ +def setup(app): + return { + 'parallel_write_safe': False + } diff --git a/tests/roots/test-footnotes/bar.rst b/tests/roots/test-footnotes/bar.rst new file mode 100644 index 0000000..660c663 --- /dev/null +++ b/tests/roots/test-footnotes/bar.rst @@ -0,0 +1,6 @@ +bar +=== + +Same footnote number [1]_ in bar.rst + +.. [1] footnote in bar diff --git a/tests/roots/test-footnotes/baz.rst b/tests/roots/test-footnotes/baz.rst new file mode 100644 index 0000000..af496c5 --- /dev/null +++ b/tests/roots/test-footnotes/baz.rst @@ -0,0 +1,6 @@ +baz +=== + +Auto footnote number [#]_ in baz.rst + +.. [#] footnote in baz diff --git a/tests/roots/test-footnotes/conf.py b/tests/roots/test-footnotes/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-footnotes/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-footnotes/index.rst b/tests/roots/test-footnotes/index.rst new file mode 100644 index 0000000..f2c5d0e --- /dev/null +++ b/tests/roots/test-footnotes/index.rst @@ -0,0 +1,188 @@ +=============== +test-footenotes +=============== + +.. toctree:: + + bar + baz + +.. contents:: + :local: + +The section with a reference to [AuthorYear]_ +============================================= + +.. figure:: rimg.png + + This is the figure caption with a reference to [AuthorYear]_. + +.. list-table:: The table title with a reference to [AuthorYear]_ + :header-rows: 1 + + * - Header1 + - Header2 + * - Content + - Content + +.. rubric:: The rubric title with a reference to [AuthorYear]_ + +.. [#] First + +* First footnote: [#]_ +* Second footnote: [1]_ +* `Sphinx `_ +* Third footnote: [#]_ +* Fourth footnote: [#named]_ +* `URL including tilde `_ +* GitHub Page: `https://github.com/sphinx-doc/sphinx `_ +* Mailing list: `sphinx-dev@googlegroups.com `_ + +.. [AuthorYear] Author, Title, Year +.. [1] Second +.. [#] Third [#]_ +.. [#] Footnote inside footnote +.. [#named] Fourth + +The section with a reference to [#]_ +===================================== + +.. [#] Footnote in section + +`URL in term `_ + Description Description Description ... + +Footnote in term [#]_ + Description Description Description ... + + `Term in deflist `_ + Description2 + +.. [#] Footnote in term + +.. figure:: rimg.png + + This is the figure caption with a footnote to [#]_. + +.. [#] Footnote in caption + +.. list-table:: footnote [#]_ in caption of normal table + :widths: 1 1 + :header-rows: 1 + + * - name + - desc + * - a + - b + * - a + - b + +.. [#] Foot note in table + +.. list-table:: footnote [#]_ in caption [#]_ of longtable + :widths: 1 1 + :header-rows: 1 + + * - name + - desc + * - This is a reference to the code-block in the footnote: + :ref:`codeblockinfootnote` + - This is one more footnote with some code in it [#]_. + * - This is a reference to the other code block: + :ref:`codeblockinanotherfootnote` + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + * - a + - b + +.. [#] Foot note in longtable + +.. [#] Second footnote in caption of longtable + + .. code-block:: python + :caption: I am in a footnote + :name: codeblockinfootnote + + def foo(x,y): + return x+y + +.. [#] Third footnote in longtable + + .. code-block:: python + :caption: I am also in a footnote + :name: codeblockinanotherfootnote + + def bar(x,y): + return x+y + +The section with an object description +====================================== + +.. py:function:: dummy(N) + :no-index: + +Footnotes referred twice +======================== + +* Explicitly numbered footnote: [100]_ [100]_ +* Named footnote: [#twice]_ [#twice]_ + +.. [100] Numbered footnote +.. [#twice] Named footnote diff --git a/tests/roots/test-footnotes/rimg.png b/tests/roots/test-footnotes/rimg.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-footnotes/rimg.png differ diff --git a/tests/roots/test-gettext-template/_templates/template1.html b/tests/roots/test-gettext-template/_templates/template1.html new file mode 100644 index 0000000..f4b49f1 --- /dev/null +++ b/tests/roots/test-gettext-template/_templates/template1.html @@ -0,0 +1,5 @@ +{% extends "layout.html" %} +{% block body %} +

{{ _('Template 1') }}

+

{%trans%}This is Template 1.{%endtrans%}

+{% endblock %} diff --git a/tests/roots/test-gettext-template/_templates/template2.html b/tests/roots/test-gettext-template/_templates/template2.html new file mode 100644 index 0000000..2a21069 --- /dev/null +++ b/tests/roots/test-gettext-template/_templates/template2.html @@ -0,0 +1,5 @@ +{% extends "layout.html" %} +{% block body %} +

{{ _('Template 2') }}

+

{%trans%}This is Template 2.{%endtrans%}

+{% endblock %} diff --git a/tests/roots/test-gettext-template/conf.py b/tests/roots/test-gettext-template/conf.py new file mode 100644 index 0000000..3f793b7 --- /dev/null +++ b/tests/roots/test-gettext-template/conf.py @@ -0,0 +1 @@ +templates_path = ['_templates'] diff --git a/tests/roots/test-gettext-template/index.rst b/tests/roots/test-gettext-template/index.rst new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-glossary/conf.py b/tests/roots/test-glossary/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-glossary/index.rst b/tests/roots/test-glossary/index.rst new file mode 100644 index 0000000..1d84a02 --- /dev/null +++ b/tests/roots/test-glossary/index.rst @@ -0,0 +1,22 @@ +test-glossary +============= + +.. glossary:: + :sorted: + + boson + Particle with integer spin. + + *fermion* + Particle with half-integer spin. + + tauon + myon + electron + Examples for fermions. + + über + Gewisse + + ähnlich + Dinge diff --git a/tests/roots/test-highlight_options/conf.py b/tests/roots/test-highlight_options/conf.py new file mode 100644 index 0000000..90997d4 --- /dev/null +++ b/tests/roots/test-highlight_options/conf.py @@ -0,0 +1,4 @@ +highlight_options = { + 'default': {'default_option': True}, + 'python': {'python_option': True} +} diff --git a/tests/roots/test-highlight_options/index.rst b/tests/roots/test-highlight_options/index.rst new file mode 100644 index 0000000..389041a --- /dev/null +++ b/tests/roots/test-highlight_options/index.rst @@ -0,0 +1,14 @@ +test-highlight_options +====================== + +.. code-block:: + + blah blah blah + +.. code-block:: python + + blah blah blah + +.. code-block:: java + + blah blah blah diff --git a/tests/roots/test-html_assets/conf.py b/tests/roots/test-html_assets/conf.py new file mode 100644 index 0000000..7f94bbb --- /dev/null +++ b/tests/roots/test-html_assets/conf.py @@ -0,0 +1,12 @@ +project = 'Sphinx' +version = '1.4.4' + +html_static_path = ['static', 'subdir'] +html_extra_path = ['extra', 'subdir'] +html_css_files = ['css/style.css', + ('https://example.com/custom.css', + {'title': 'title', 'media': 'print', 'priority': 400})] +html_js_files = ['js/custom.js', + ('https://example.com/script.js', + {'async': 'async', 'priority': 400})] +exclude_patterns = ['**/_build', '**/.htpasswd'] diff --git a/tests/roots/test-html_assets/extra/.htaccess b/tests/roots/test-html_assets/extra/.htaccess new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/extra/.htpasswd b/tests/roots/test-html_assets/extra/.htpasswd new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/extra/API.html_t b/tests/roots/test-html_assets/extra/API.html_t new file mode 100644 index 0000000..34ecd9d --- /dev/null +++ b/tests/roots/test-html_assets/extra/API.html_t @@ -0,0 +1 @@ +{{ project }}-{{ version }} diff --git a/tests/roots/test-html_assets/extra/css/style.css b/tests/roots/test-html_assets/extra/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/extra/index.rst b/tests/roots/test-html_assets/extra/index.rst new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/extra/rimg.png b/tests/roots/test-html_assets/extra/rimg.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-html_assets/extra/rimg.png differ diff --git a/tests/roots/test-html_assets/extra/subdir/.htaccess b/tests/roots/test-html_assets/extra/subdir/.htaccess new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/extra/subdir/.htpasswd b/tests/roots/test-html_assets/extra/subdir/.htpasswd new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/index.rst b/tests/roots/test-html_assets/index.rst new file mode 100644 index 0000000..6d56194 --- /dev/null +++ b/tests/roots/test-html_assets/index.rst @@ -0,0 +1,3 @@ +test-html_extra_path +===================== +this is dummy content diff --git a/tests/roots/test-html_assets/static/.htaccess b/tests/roots/test-html_assets/static/.htaccess new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/static/.htpasswd b/tests/roots/test-html_assets/static/.htpasswd new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/static/API.html_t b/tests/roots/test-html_assets/static/API.html_t new file mode 100644 index 0000000..34ecd9d --- /dev/null +++ b/tests/roots/test-html_assets/static/API.html_t @@ -0,0 +1 @@ +{{ project }}-{{ version }} diff --git a/tests/roots/test-html_assets/static/css/style.css b/tests/roots/test-html_assets/static/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/static/index.rst b/tests/roots/test-html_assets/static/index.rst new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/static/js/custom.js b/tests/roots/test-html_assets/static/js/custom.js new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/static/rimg.png b/tests/roots/test-html_assets/static/rimg.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-html_assets/static/rimg.png differ diff --git a/tests/roots/test-html_assets/static/subdir/.htaccess b/tests/roots/test-html_assets/static/subdir/.htaccess new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/static/subdir/.htpasswd b/tests/roots/test-html_assets/static/subdir/.htpasswd new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/subdir/_build/index.html b/tests/roots/test-html_assets/subdir/_build/index.html new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_assets/subdir/background.png b/tests/roots/test-html_assets/subdir/background.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-html_assets/subdir/background.png differ diff --git a/tests/roots/test-html_entity/conf.py b/tests/roots/test-html_entity/conf.py new file mode 100644 index 0000000..46bb290 --- /dev/null +++ b/tests/roots/test-html_entity/conf.py @@ -0,0 +1,2 @@ +html_theme = 'classic' +exclude_patterns = ['_build'] diff --git a/tests/roots/test-html_entity/index.rst b/tests/roots/test-html_entity/index.rst new file mode 100644 index 0000000..11f4f4c --- /dev/null +++ b/tests/roots/test-html_entity/index.rst @@ -0,0 +1,31 @@ +.. _index: + +test-html_entity (#3450) +========================= + +Empty cell +---------- + +.. list-table:: + + - * un + * + * trois + +Return description in function signature +---------------------------------------- + +.. py:function:: test() -> string + + rarr + +Field list that has long name (over 14 characters) +-------------------------------------------------- + +:abcdefghijklmnopqrstuvwxyz: fieldlist + +Option list that has long name (over 14 characters) +--------------------------------------------------- + +-a all +-b long_long_file use file diff --git a/tests/roots/test-html_file_checksum/conf.py b/tests/roots/test-html_file_checksum/conf.py new file mode 100644 index 0000000..f918814 --- /dev/null +++ b/tests/roots/test-html_file_checksum/conf.py @@ -0,0 +1 @@ +html_static_path = ['static'] diff --git a/tests/roots/test-html_file_checksum/index.rst b/tests/roots/test-html_file_checksum/index.rst new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_file_checksum/static/empty.js b/tests/roots/test-html_file_checksum/static/empty.js new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_file_checksum/static/script.js b/tests/roots/test-html_file_checksum/static/script.js new file mode 100644 index 0000000..9a21456 --- /dev/null +++ b/tests/roots/test-html_file_checksum/static/script.js @@ -0,0 +1 @@ +/* Script */ diff --git a/tests/roots/test-html_file_checksum/static/stylesheet-a.css b/tests/roots/test-html_file_checksum/static/stylesheet-a.css new file mode 100644 index 0000000..3a5d802 --- /dev/null +++ b/tests/roots/test-html_file_checksum/static/stylesheet-a.css @@ -0,0 +1 @@ +/* Stylesheet A */ diff --git a/tests/roots/test-html_file_checksum/static/stylesheet-b.css b/tests/roots/test-html_file_checksum/static/stylesheet-b.css new file mode 100644 index 0000000..ad5ff28 --- /dev/null +++ b/tests/roots/test-html_file_checksum/static/stylesheet-b.css @@ -0,0 +1 @@ +/* Stylesheet B */ diff --git a/tests/roots/test-html_scaled_image_link/conf.py b/tests/roots/test-html_scaled_image_link/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_scaled_image_link/img.png b/tests/roots/test-html_scaled_image_link/img.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-html_scaled_image_link/img.png differ diff --git a/tests/roots/test-html_scaled_image_link/index.rst b/tests/roots/test-html_scaled_image_link/index.rst new file mode 100644 index 0000000..0e47940 --- /dev/null +++ b/tests/roots/test-html_scaled_image_link/index.rst @@ -0,0 +1,11 @@ +test-html_scaled_image_link +=========================== + +.. image:: img.png + +.. image:: img.png + :scale: 50% + +.. image:: img.png + :scale: 50% + :class: no-scaled-link diff --git a/tests/roots/test-html_signaturereturn_icon/conf.py b/tests/roots/test-html_signaturereturn_icon/conf.py new file mode 100644 index 0000000..a695d18 --- /dev/null +++ b/tests/roots/test-html_signaturereturn_icon/conf.py @@ -0,0 +1 @@ +extensions = ['sphinx.ext.autodoc'] diff --git a/tests/roots/test-html_signaturereturn_icon/index.rst b/tests/roots/test-html_signaturereturn_icon/index.rst new file mode 100644 index 0000000..4ff4eb6 --- /dev/null +++ b/tests/roots/test-html_signaturereturn_icon/index.rst @@ -0,0 +1,4 @@ +test-html_signaturereturn_icon +============================== + +.. py:function:: foo(a: bool, b: int) -> str diff --git a/tests/roots/test-html_style/_static/default.css b/tests/roots/test-html_style/_static/default.css new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-html_style/conf.py b/tests/roots/test-html_style/conf.py new file mode 100644 index 0000000..df1b310 --- /dev/null +++ b/tests/roots/test-html_style/conf.py @@ -0,0 +1,2 @@ +html_style = 'default.css' +html_static_path = ['_static'] diff --git a/tests/roots/test-html_style/index.rst b/tests/roots/test-html_style/index.rst new file mode 100644 index 0000000..d8aef48 --- /dev/null +++ b/tests/roots/test-html_style/index.rst @@ -0,0 +1,2 @@ +html_style +========== diff --git a/tests/roots/test-image-escape/conf.py b/tests/roots/test-image-escape/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-image-escape/img_#1.png b/tests/roots/test-image-escape/img_#1.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-image-escape/img_#1.png differ diff --git a/tests/roots/test-image-escape/index.rst b/tests/roots/test-image-escape/index.rst new file mode 100644 index 0000000..723bf43 --- /dev/null +++ b/tests/roots/test-image-escape/index.rst @@ -0,0 +1,5 @@ +Sphinx image handling +===================== + +.. an image with a character that is valid in a local file path but not a URL +.. image:: img_#1.png diff --git a/tests/roots/test-image-in-parsed-literal/conf.py b/tests/roots/test-image-in-parsed-literal/conf.py new file mode 100644 index 0000000..5d06da6 --- /dev/null +++ b/tests/roots/test-image-in-parsed-literal/conf.py @@ -0,0 +1,9 @@ +exclude_patterns = ['_build'] + +rst_epilog = ''' +.. |picture| image:: pic.png + :height: 1cm + :scale: 200% + :align: middle + :alt: alternative_text +''' diff --git a/tests/roots/test-image-in-parsed-literal/index.rst b/tests/roots/test-image-in-parsed-literal/index.rst new file mode 100644 index 0000000..80e1008 --- /dev/null +++ b/tests/roots/test-image-in-parsed-literal/index.rst @@ -0,0 +1,9 @@ +test-image-in-parsed-literal +============================ + +Dummy text + +.. parsed-literal:: + + |picture|\ AFTER + diff --git a/tests/roots/test-image-in-parsed-literal/pic.png b/tests/roots/test-image-in-parsed-literal/pic.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-image-in-parsed-literal/pic.png differ diff --git a/tests/roots/test-image-in-section/conf.py b/tests/roots/test-image-in-section/conf.py new file mode 100644 index 0000000..9cb250c --- /dev/null +++ b/tests/roots/test-image-in-section/conf.py @@ -0,0 +1,8 @@ +exclude_patterns = ['_build'] + +rst_epilog = ''' +.. |picture| image:: pic.png + :width: 15pt + :height: 15pt + :alt: alternative_text +''' diff --git a/tests/roots/test-image-in-section/index.rst b/tests/roots/test-image-in-section/index.rst new file mode 100644 index 0000000..08416d6 --- /dev/null +++ b/tests/roots/test-image-in-section/index.rst @@ -0,0 +1,22 @@ +test-image-in-section +===================== +this is dummy content + + +|picture| Test section +---------------------- +blah blah blah + + +Another section +--------------- +another blah + + +Other [blah] |picture| section +------------------------------ +other blah + +|picture| +--------- +blah blah blah diff --git a/tests/roots/test-image-in-section/pic.png b/tests/roots/test-image-in-section/pic.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-image-in-section/pic.png differ diff --git a/tests/roots/test-images/conf.py b/tests/roots/test-images/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-images/img.gif b/tests/roots/test-images/img.gif new file mode 100644 index 0000000..8f02686 Binary files /dev/null and b/tests/roots/test-images/img.gif differ diff --git a/tests/roots/test-images/img.ja.png b/tests/roots/test-images/img.ja.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-images/img.ja.png differ diff --git a/tests/roots/test-images/img.pdf b/tests/roots/test-images/img.pdf new file mode 100644 index 0000000..cacbd85 Binary files /dev/null and b/tests/roots/test-images/img.pdf differ diff --git a/tests/roots/test-images/img.png b/tests/roots/test-images/img.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-images/img.png differ diff --git a/tests/roots/test-images/img.zh.png b/tests/roots/test-images/img.zh.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-images/img.zh.png differ diff --git a/tests/roots/test-images/index.rst b/tests/roots/test-images/index.rst new file mode 100644 index 0000000..14a2987 --- /dev/null +++ b/tests/roots/test-images/index.rst @@ -0,0 +1,29 @@ +test-image +========== + +.. image:: rimg.png + +.. figure:: rimg.png + + The caption of pic + +.. image:: img.* + +.. figure:: img.* + + The caption of img + +.. image:: testimäge.png + +.. image:: rimg.png + :target: https://www.sphinx-doc.org/ + +.. image:: rimg.png + :align: center + :target: https://www.python.org/ + +.. a remote image +.. image:: https://www.python.org/static/img/python-logo.png + +.. non-exist remote image +.. image:: https://www.google.com/NOT_EXIST.PNG diff --git a/tests/roots/test-images/rimg.png b/tests/roots/test-images/rimg.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-images/rimg.png differ diff --git a/tests/roots/test-images/rimg.png.xx b/tests/roots/test-images/rimg.png.xx new file mode 100644 index 0000000..1081dc1 Binary files /dev/null and b/tests/roots/test-images/rimg.png.xx differ diff --git a/tests/roots/test-images/rimg.xx.png b/tests/roots/test-images/rimg.xx.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-images/rimg.xx.png differ diff --git a/tests/roots/test-images/subdir/index.rst b/tests/roots/test-images/subdir/index.rst new file mode 100644 index 0000000..72e742c --- /dev/null +++ b/tests/roots/test-images/subdir/index.rst @@ -0,0 +1,10 @@ +test-images/subdir +================== + +.. image:: rimg.png + +.. image:: svgimg.* + +.. figure:: svgimg.* + + The caption of svgimg diff --git a/tests/roots/test-images/subdir/rimg.png b/tests/roots/test-images/subdir/rimg.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-images/subdir/rimg.png differ diff --git a/tests/roots/test-images/subdir/rimg.xx.png b/tests/roots/test-images/subdir/rimg.xx.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-images/subdir/rimg.xx.png differ diff --git a/tests/roots/test-images/subdir/svgimg.pdf b/tests/roots/test-images/subdir/svgimg.pdf new file mode 100644 index 0000000..cacbd85 Binary files /dev/null and b/tests/roots/test-images/subdir/svgimg.pdf differ diff --git a/tests/roots/test-images/subdir/svgimg.svg b/tests/roots/test-images/subdir/svgimg.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-images/subdir/svgimg.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/roots/test-images/subdir/svgimg.xx.svg b/tests/roots/test-images/subdir/svgimg.xx.svg new file mode 100644 index 0000000..2bae0b9 --- /dev/null +++ b/tests/roots/test-images/subdir/svgimg.xx.svg @@ -0,0 +1,4 @@ + + + + diff --git "a/tests/roots/test-images/testim\303\244ge.png" "b/tests/roots/test-images/testim\303\244ge.png" new file mode 100644 index 0000000..a97e86d Binary files /dev/null and "b/tests/roots/test-images/testim\303\244ge.png" differ diff --git a/tests/roots/test-index_on_title/conf.py b/tests/roots/test-index_on_title/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-index_on_title/contents.rst b/tests/roots/test-index_on_title/contents.rst new file mode 100644 index 0000000..8256c42 --- /dev/null +++ b/tests/roots/test-index_on_title/contents.rst @@ -0,0 +1,5 @@ +index_on_title +============== + +Test for :index:`index` in top level title +------------------------------------------ diff --git a/tests/roots/test-inheritance/basic_diagram.rst b/tests/roots/test-inheritance/basic_diagram.rst new file mode 100644 index 0000000..4c3838e --- /dev/null +++ b/tests/roots/test-inheritance/basic_diagram.rst @@ -0,0 +1,5 @@ +Basic Diagram +============== + +.. inheritance-diagram:: + dummy.test diff --git a/tests/roots/test-inheritance/conf.py b/tests/roots/test-inheritance/conf.py new file mode 100644 index 0000000..26cadca --- /dev/null +++ b/tests/roots/test-inheritance/conf.py @@ -0,0 +1,7 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.inheritance_diagram'] +source_suffix = '.rst' diff --git a/tests/roots/test-inheritance/diagram_module_w_2_top_classes.rst b/tests/roots/test-inheritance/diagram_module_w_2_top_classes.rst new file mode 100644 index 0000000..cc4365e --- /dev/null +++ b/tests/roots/test-inheritance/diagram_module_w_2_top_classes.rst @@ -0,0 +1,6 @@ +Diagram using module with 2 top classes +======================================= + +.. inheritance-diagram:: + dummy.test + :top-classes: dummy.test.B, dummy.test.C diff --git a/tests/roots/test-inheritance/diagram_w_1_top_class.rst b/tests/roots/test-inheritance/diagram_w_1_top_class.rst new file mode 100644 index 0000000..97da825 --- /dev/null +++ b/tests/roots/test-inheritance/diagram_w_1_top_class.rst @@ -0,0 +1,7 @@ +Diagram using 1 top class +========================= + +.. inheritance-diagram:: + dummy.test + :top-classes: dummy.test.B + diff --git a/tests/roots/test-inheritance/diagram_w_2_top_classes.rst b/tests/roots/test-inheritance/diagram_w_2_top_classes.rst new file mode 100644 index 0000000..8a6ae58 --- /dev/null +++ b/tests/roots/test-inheritance/diagram_w_2_top_classes.rst @@ -0,0 +1,9 @@ +Diagram using 2 top classes +=========================== + +.. inheritance-diagram:: + dummy.test.F + dummy.test.D + dummy.test.E + :top-classes: dummy.test.B, dummy.test.C + diff --git a/tests/roots/test-inheritance/diagram_w_nested_classes.rst b/tests/roots/test-inheritance/diagram_w_nested_classes.rst new file mode 100644 index 0000000..7fa0217 --- /dev/null +++ b/tests/roots/test-inheritance/diagram_w_nested_classes.rst @@ -0,0 +1,5 @@ +Diagram with Nested Classes +=========================== + +.. inheritance-diagram:: + dummy.test_nested diff --git a/tests/roots/test-inheritance/diagram_w_parts.rst b/tests/roots/test-inheritance/diagram_w_parts.rst new file mode 100644 index 0000000..65a8318 --- /dev/null +++ b/tests/roots/test-inheritance/diagram_w_parts.rst @@ -0,0 +1,7 @@ +Diagram using the parts option +============================== + +.. inheritance-diagram:: + dummy.test + :parts: 1 + diff --git a/tests/roots/test-inheritance/dummy/__init__.py b/tests/roots/test-inheritance/dummy/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-inheritance/dummy/test.py b/tests/roots/test-inheritance/dummy/test.py new file mode 100644 index 0000000..12fe8d9 --- /dev/null +++ b/tests/roots/test-inheritance/dummy/test.py @@ -0,0 +1,35 @@ +r""" + + Test with a class diagram like this:: + + A + / \ + B C + / \ / \ + E D F + +""" + + +class A: + pass + + +class B(A): + pass + + +class C(A): + pass + + +class D(B, C): + pass + + +class E(B): + pass + + +class F(C): + pass diff --git a/tests/roots/test-inheritance/dummy/test_nested.py b/tests/roots/test-inheritance/dummy/test_nested.py new file mode 100644 index 0000000..4b68018 --- /dev/null +++ b/tests/roots/test-inheritance/dummy/test_nested.py @@ -0,0 +1,11 @@ +"""Test with nested classes. +""" + + +class A: + class B: + pass + + +class C(A.B): + pass diff --git a/tests/roots/test-inheritance/index.rst b/tests/roots/test-inheritance/index.rst new file mode 100644 index 0000000..db4fbac --- /dev/null +++ b/tests/roots/test-inheritance/index.rst @@ -0,0 +1,4 @@ +.. toctree:: + :glob: + + * diff --git a/tests/roots/test-intl/_templates/contents.html b/tests/roots/test-intl/_templates/contents.html new file mode 100644 index 0000000..d730545 --- /dev/null +++ b/tests/roots/test-intl/_templates/contents.html @@ -0,0 +1,10 @@ +{% extends "layout.html" %} +{% block body %} +

{{ _('Welcome') }}

+

{%trans%}Sphinx {{ version }}{%endtrans%}

+{% endblock %} + +{% block comment %} +utf-8 encoded string: ニシキヘビ +{% endblock %} + diff --git a/tests/roots/test-intl/admonitions.txt b/tests/roots/test-intl/admonitions.txt new file mode 100644 index 0000000..a539461 --- /dev/null +++ b/tests/roots/test-intl/admonitions.txt @@ -0,0 +1,50 @@ +:tocdepth: 2 + +Admonitions +================== +.. #1206 gettext did not translate admonition directive's title + +.. attention:: attention title + + attention body + +.. caution:: caution title + + caution body + +.. danger:: danger title + + danger body + +.. error:: error title + + error body + +.. hint:: hint title + + hint body + +.. important:: important title + + important body + +.. note:: note title + + note body + +.. tip:: tip title + + tip body + +.. warning:: warning title + + warning body + +.. admonition:: admonition title + + admonition body + +.. admonition:: 1. admonition title + + admonition body + diff --git a/tests/roots/test-intl/bom.txt b/tests/roots/test-intl/bom.txt new file mode 100644 index 0000000..3fea824 --- /dev/null +++ b/tests/roots/test-intl/bom.txt @@ -0,0 +1,5 @@ +File with UTF-8 BOM +=================== + +This file has a UTF-8 "BOM". + diff --git a/tests/roots/test-intl/conf.py b/tests/roots/test-intl/conf.py new file mode 100644 index 0000000..96ac664 --- /dev/null +++ b/tests/roots/test-intl/conf.py @@ -0,0 +1,8 @@ +project = 'Sphinx intl ' +source_suffix = '.txt' +keep_warnings = True +templates_path = ['_templates'] +html_additional_pages = {'contents': 'contents.html'} +release = version = '2013.120' +gettext_additional_targets = ['index'] +exclude_patterns = ['_build'] diff --git a/tests/roots/test-intl/definition_terms.txt b/tests/roots/test-intl/definition_terms.txt new file mode 100644 index 0000000..4c56288 --- /dev/null +++ b/tests/roots/test-intl/definition_terms.txt @@ -0,0 +1,16 @@ +:tocdepth: 2 + +i18n with definition terms +========================== + +Some term + The corresponding definition + +Some *term* `with link `__ + The corresponding definition #2 + +Some **term** with : classifier1 : classifier2 + The corresponding definition + +Some term with : classifier[] + The corresponding definition diff --git a/tests/roots/test-intl/docfields.txt b/tests/roots/test-intl/docfields.txt new file mode 100644 index 0000000..b1b3c89 --- /dev/null +++ b/tests/roots/test-intl/docfields.txt @@ -0,0 +1,46 @@ +:tocdepth: 2 + +i18n with docfields +=================== + +.. single TypedField + +.. class:: Cls1 + :no-index: + + :param param: description of parameter param + +.. grouped TypedFields + +.. class:: Cls2 + :no-index: + + :param foo: description of parameter foo + :param bar: description of parameter bar + + +.. single GroupedField + +.. class:: Cls3(values) + :no-index: + + :raises ValueError: if the values are out of range + +.. grouped GroupedFields + +.. class:: Cls4(values) + :no-index: + + :raises TypeError: if the values are not valid + :raises ValueError: if the values are out of range + + +.. single Field + +.. class:: Cls5 + :no-index: + + :returns: a new :class:`Cls3` instance + +.. Field is never grouped + diff --git a/tests/roots/test-intl/external_links.txt b/tests/roots/test-intl/external_links.txt new file mode 100644 index 0000000..1cecbee --- /dev/null +++ b/tests/roots/test-intl/external_links.txt @@ -0,0 +1,35 @@ +:tocdepth: 2 + +i18n with external links +======================== +.. #1044 external-links-dont-work-in-localized-html + +External link to Python_. + +Internal link to `i18n with external links`_. + +Inline link by `Sphinx Site `_. + +Unnamed link__. + +.. _Python: http://python.org/index.html +.. __: http://google.com + + +link target swapped translation +================================ + +link to external1_ and external2_. + +link to `Sphinx Site `_ and `Python Site `_. + +.. _external1: https://www.google.com/external1 +.. _external2: https://www.google.com/external2 + + +Multiple references in the same line +===================================== + +Link to `Sphinx Site `_, `Python Site `_, Python_, Unnamed__ and `i18n with external links`_. + +.. __: http://google.com diff --git a/tests/roots/test-intl/figure.txt b/tests/roots/test-intl/figure.txt new file mode 100644 index 0000000..633e12e --- /dev/null +++ b/tests/roots/test-intl/figure.txt @@ -0,0 +1,53 @@ +:tocdepth: 2 + +i18n with figure caption +======================== + +.. figure:: i18n.png + + My caption of the figure + + My description paragraph1 of the figure. + + My description paragraph2 of the figure. + +figure in the block +--------------------- + +block + + .. figure:: i18n.png + + My caption of the figure + + My description paragraph1 of the figure. + + My description paragraph2 of the figure. + + +image url and alt +------------------- + +.. image:: i18n.png + :alt: i18n + +.. figure:: img.png + :alt: img + + +image on substitution +--------------------- + +.. |sub image| image:: i18n.png + +image under note +----------------- + +.. note:: + + .. image:: i18n.png + :alt: i18n under note + + .. figure:: img.png + :alt: img under note + diff --git a/tests/roots/test-intl/footnote.txt b/tests/roots/test-intl/footnote.txt new file mode 100644 index 0000000..0bbed91 --- /dev/null +++ b/tests/roots/test-intl/footnote.txt @@ -0,0 +1,14 @@ +:tocdepth: 2 + +i18n with Footnote +================== +.. #955 cant-build-html-with-footnotes-when-using + +[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_ [#named]_ [*]_. +second footnote_ref [100]_. + +.. [#] This is a auto numbered footnote. +.. [ref] This is a named footnote. +.. [100] This is a numbered footnote. +.. [#named] This is a auto numbered named footnote. +.. [*] This is a auto symbol footnote. diff --git a/tests/roots/test-intl/glossary_terms.txt b/tests/roots/test-intl/glossary_terms.txt new file mode 100644 index 0000000..473d857 --- /dev/null +++ b/tests/roots/test-intl/glossary_terms.txt @@ -0,0 +1,29 @@ +:tocdepth: 2 + +i18n with glossary terms +======================== + +.. glossary:: + + Some term + The corresponding glossary + + Some other term + The corresponding glossary #2 + +link to :term:`Some term`. + +Translated glossary should be sorted by translated terms: + +.. glossary:: + :sorted: + + AAA + Define AAA + + CCC + EEE + Define CCC + + BBB + Define BBB diff --git a/tests/roots/test-intl/glossary_terms_inconsistency.txt b/tests/roots/test-intl/glossary_terms_inconsistency.txt new file mode 100644 index 0000000..837411b --- /dev/null +++ b/tests/roots/test-intl/glossary_terms_inconsistency.txt @@ -0,0 +1,6 @@ +:tocdepth: 2 + +i18n with glossary terms inconsistency +====================================== + +1. link to :term:`Some term` and :term:`Some other term`. diff --git a/tests/roots/test-intl/i18n.png b/tests/roots/test-intl/i18n.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-intl/i18n.png differ diff --git a/tests/roots/test-intl/img.png b/tests/roots/test-intl/img.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-intl/img.png differ diff --git a/tests/roots/test-intl/index.txt b/tests/roots/test-intl/index.txt new file mode 100644 index 0000000..9de15d5 --- /dev/null +++ b/tests/roots/test-intl/index.txt @@ -0,0 +1,40 @@ +CONTENTS +======== + +.. meta:: + :description: testdata for i18n + :keywords: i18n, sphinx, markup + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + + subdir/index + bom + warnings + footnote + external_links + refs_inconsistency + literalblock + seealso + definition_terms + figure + index_entries + role_xref + glossary_terms + glossary_terms_inconsistency + versionchange + docfields + raw + refs + section + translation_progress + topic + +.. toctree:: + :maxdepth: 2 + :caption: Hidden Toc + :hidden: + + only diff --git a/tests/roots/test-intl/index_entries.txt b/tests/roots/test-intl/index_entries.txt new file mode 100644 index 0000000..e9300d0 --- /dev/null +++ b/tests/roots/test-intl/index_entries.txt @@ -0,0 +1,24 @@ +:tocdepth: 2 + +i18n with index entries +======================= + +.. index:: + single: Mailing List + pair: Newsletter; Recipients List + +index target section +-------------------- + +this is :index:`Newsletter` target paragraph. + + +various index entries +--------------------- + +.. index:: + triple: First; Second; Third + see: Entry; Mailing List + seealso: See; Newsletter + +That's all. diff --git a/tests/roots/test-intl/label_target.txt b/tests/roots/test-intl/label_target.txt new file mode 100644 index 0000000..ac00084 --- /dev/null +++ b/tests/roots/test-intl/label_target.txt @@ -0,0 +1,67 @@ +:tocdepth: 2 + +.. _implicit-target: + +section and label +================== + +.. This section's label and section title are different. +.. This case, the section have 2 target id. + +:ref:`implicit-target` point to ``implicit-target`` and +`section and label`_ point to ``section-and-label``. + + +.. _explicit-target: + +explicit-target +================ + +.. This section's label equals to section title. +.. This case, a duplicated target id is generated by docutils. + +:ref:`explicit-target` point to ``explicit-target`` and +`explicit-target`_ point to duplicated id like ``id1``. + + +implicit section name +====================== + +.. This section have no label. +.. This case, the section have one id. + +`implicit section name`_ point to ``implicit-section-name``. + +duplicated sub section +------------------------ + +.. This section have no label, but name will be duplicated by next section. +.. This case, the section have one id. + +`duplicated sub section`_ is broken link. + +.. There is no way to link to this section's ``duplicated-sub-section``` by +.. using formal reStructuredText markup. + +duplicated sub section +------------------------ + +.. This section have no label, but the section was a duplicate name. +.. This case, a duplicated target id is generated by docutils. + +.. There is no way to link to this section's duplicated id like ``id2`` by +.. using formal reStructuredText markup. + + +.. _bridge label: `label bridged target section`_ +.. _bridge label2: `section and label`_ + +label bridged target section +============================= + +.. This section is targeted through label definition. + +`bridge label`_ is not translatable but linked to translated section title. + +`bridge label2`_ point to ``section and label`` and `bridge label`_ point to ``label bridged target section``. The second appeared `bridge label2`_ point to correct target. + diff --git a/tests/roots/test-intl/literalblock.txt b/tests/roots/test-intl/literalblock.txt new file mode 100644 index 0000000..583b5b6 --- /dev/null +++ b/tests/roots/test-intl/literalblock.txt @@ -0,0 +1,71 @@ +:tocdepth: 2 + +i18n with literal block +========================= + +Correct literal block:: + + this is + literal block + +Missing literal block:: + +That's all. + +.. literalinclude:: raw.txt + :caption: included raw.txt + +code blocks +============== + +.. highlight:: ruby + +:: + + def main + 'result' + end + +:: + + #include + int main(int argc, char** argv) + { + return 0; + } + +.. code-block:: c + :caption: example of C language + + #include + int main(int argc, char** argv) + { + return 0; + } + + +* :: + + literal-block + in list + +.. highlight:: none + +:: + + test_code_for_noqa() + continued() + + +doctest blocks +============== + +.. highlight:: python + +>>> import sys # sys importing +>>> def main(): # define main function +... sys.stdout.write('hello') # call write method of stdout object +>>> +>>> if __name__ == '__main__': # if run this py file as python script +... main() # call main + diff --git a/tests/roots/test-intl/noqa.txt b/tests/roots/test-intl/noqa.txt new file mode 100644 index 0000000..004b301 --- /dev/null +++ b/tests/roots/test-intl/noqa.txt @@ -0,0 +1,16 @@ +First section +============= + +Some text with a reference, :ref:`next-section`. + +Another reference: :ref:`next-section`. + +This should allow to test escaping ``#noqa``. + +.. _next-section: + +Next section +============ + +Some text, again referring to the section: :ref:`next-section`. + diff --git a/tests/roots/test-intl/only.txt b/tests/roots/test-intl/only.txt new file mode 100644 index 0000000..2c8990e --- /dev/null +++ b/tests/roots/test-intl/only.txt @@ -0,0 +1,14 @@ +Only directive +-------------- + +.. only:: html + + In HTML. + +.. only:: latex + + In LaTeX. + +.. only:: html or latex + + In both. diff --git a/tests/roots/test-intl/raw.txt b/tests/roots/test-intl/raw.txt new file mode 100644 index 0000000..fe77f6c --- /dev/null +++ b/tests/roots/test-intl/raw.txt @@ -0,0 +1,8 @@ +=== +Raw +=== + +.. raw:: html + + + diff --git a/tests/roots/test-intl/refs.txt b/tests/roots/test-intl/refs.txt new file mode 100644 index 0000000..4a094b2 --- /dev/null +++ b/tests/roots/test-intl/refs.txt @@ -0,0 +1,48 @@ +References +=========== + +Translation Tips +----------------- + +.. _download Sphinx: https://pypi.org/project/Sphinx/ +.. _Docutils site: https://docutils.sourceforge.io/ +.. _Sphinx site: http://sphinx-doc.org/ + + +A-1. Here's how you can `download Sphinx`_. + +A-2. Here's how you can `download Sphinx`_. + +A-3. Here's how you can `download Sphinx`_. + +B-1. `Docutils site`_ and `Sphinx site`_. + +B-2. `Docutils site`_ and `Sphinx site`_. + +B-3. `Docutils site`_ and `Sphinx site`_. + +B-4. `Docutils site`_ and `Sphinx site`_. + +C-1. Link to `Translation Tips`_ section. + +C-2. Link to `Translation Tips`_ section. + +C-3. Link to `Translation Tips`_ section. + +C-4. Link to `Translation Tips`_ section. + +C-5. Link to `Translation Tips`_ section. + +D-1. Link to `Translation Tips`_ and `Next Section`_ section. + +D-2. Link to `Translation Tips`_ and `Next Section`_ section. + +D-3. Link to `Translation Tips`_ and `Next Section`_ section. + +D-4. Link to `Translation Tips`_ and `Next Section`_ section. + +D-5. Link to `Translation Tips`_ and `Next Section`_ section. + +Next Section +------------- +Last updated |today|. diff --git a/tests/roots/test-intl/refs_inconsistency.txt b/tests/roots/test-intl/refs_inconsistency.txt new file mode 100644 index 0000000..b16623a --- /dev/null +++ b/tests/roots/test-intl/refs_inconsistency.txt @@ -0,0 +1,13 @@ +:tocdepth: 2 + +i18n with refs inconsistency +============================= + +* [100]_ for [#]_ citation [ref2]_. +* for reference_. +* normal text. + +.. [#] This is a auto numbered footnote. +.. [ref2] This is a citation. +.. [100] This is a numbered footnote. +.. _reference: http://www.example.com diff --git a/tests/roots/test-intl/refs_python_domain.txt b/tests/roots/test-intl/refs_python_domain.txt new file mode 100644 index 0000000..2b021f2 --- /dev/null +++ b/tests/roots/test-intl/refs_python_domain.txt @@ -0,0 +1,15 @@ +:tocdepth: 2 + +i18n with python domain refs +============================= + +.. currentmodule:: sensitive + +See this decorator: :func:`sensitive_variables`. + +.. function:: sensitive_variables(*variables) + + Some description + +.. currentmodule:: reporting + diff --git a/tests/roots/test-intl/role_xref.txt b/tests/roots/test-intl/role_xref.txt new file mode 100644 index 0000000..2919b5c --- /dev/null +++ b/tests/roots/test-intl/role_xref.txt @@ -0,0 +1,40 @@ +:tocdepth: 2 + +.. _i18n-role-xref: + +i18n role xref +============== + +link to :term:`Some term`, :ref:`i18n-role-xref`, :doc:`index`. + +.. _same-type-links: + +same type links +================= + +link to :term:`Some term` and :term:`Some other term`. + +link to :ref:`i18n-role-xref`, :ref:`same-type-links` and :ref:`label `. + +link to :doc:`index` and :doc:`glossary_terms`. + +link to :option:`-m` and :option:`--module`. + +link to :envvar:`env1` and :envvar:`env2`. + +link to :token:`token1` and :token:`token2`. + +link to :keyword:`i18n-role-xref` and :keyword:`same-type-links`. + + +.. option:: -m + +.. option:: --module + +.. envvar:: env1 + +.. envvar:: env2 + +.. productionlist:: + token_stmt: `token1` ":" `token2` + diff --git a/tests/roots/test-intl/rubric.txt b/tests/roots/test-intl/rubric.txt new file mode 100644 index 0000000..f285d49 --- /dev/null +++ b/tests/roots/test-intl/rubric.txt @@ -0,0 +1,14 @@ +:tocdepth: 2 + +i18n with rubric +================ + +.. rubric:: rubric title + +rubric in the block +------------------- + +block + + .. rubric:: rubric title + diff --git a/tests/roots/test-intl/section.txt b/tests/roots/test-intl/section.txt new file mode 100644 index 0000000..ae0604c --- /dev/null +++ b/tests/roots/test-intl/section.txt @@ -0,0 +1,8 @@ +1. Section +========== + +.. contents:: 3. Contents Title + :local: + +2. Sub Section +-------------- diff --git a/tests/roots/test-intl/seealso.txt b/tests/roots/test-intl/seealso.txt new file mode 100644 index 0000000..ed88599 --- /dev/null +++ b/tests/roots/test-intl/seealso.txt @@ -0,0 +1,15 @@ +:tocdepth: 2 + +i18n with seealso +============================ +.. #960 directive-seelaso-ignored-in-the-gettext + +.. seealso:: short text 1 + +.. seealso:: + + long text 1 + +.. seealso:: short text 2 + + long text 2 diff --git a/tests/roots/test-intl/subdir/index.txt b/tests/roots/test-intl/subdir/index.txt new file mode 100644 index 0000000..7578ce3 --- /dev/null +++ b/tests/roots/test-intl/subdir/index.txt @@ -0,0 +1,2 @@ +subdir contents +=============== diff --git a/tests/roots/test-intl/table.txt b/tests/roots/test-intl/table.txt new file mode 100644 index 0000000..cf82438 --- /dev/null +++ b/tests/roots/test-intl/table.txt @@ -0,0 +1,20 @@ +:tocdepth: 2 + +i18n with table +=============== + +.. table:: table caption + + ======= ======= + header1 header2 + ------- ------- + text1 text2 + text3 text4 + text5 text6 + ======= ======= + +.. table:: 1. table caption + + +-----+ + |text1| + +-----+ diff --git a/tests/roots/test-intl/toctree.txt b/tests/roots/test-intl/toctree.txt new file mode 100644 index 0000000..35c956a --- /dev/null +++ b/tests/roots/test-intl/toctree.txt @@ -0,0 +1,10 @@ +i18n with toctree +================= + +.. toctree:: + :caption: caption + + figure
+ table + https://www.sphinx-doc.org/ + self diff --git a/tests/roots/test-intl/topic.txt b/tests/roots/test-intl/topic.txt new file mode 100644 index 0000000..255a334 --- /dev/null +++ b/tests/roots/test-intl/topic.txt @@ -0,0 +1,13 @@ +:tocdepth: 2 + +i18n with topic +================ + +.. topic:: Topic Title + + Topic Content + +.. topic:: 1. Topic Title + + Topic Content + diff --git a/tests/roots/test-intl/translation_progress.txt b/tests/roots/test-intl/translation_progress.txt new file mode 100644 index 0000000..f70ab7a --- /dev/null +++ b/tests/roots/test-intl/translation_progress.txt @@ -0,0 +1,40 @@ +Translation Progress +==================== + +When, in disgrace with fortune and men’s eyes, + +I all alone beweep my outcast state, + +And trouble deaf heaven with my bootless cries, + +And look upon myself, and curse my fate, + +Wishing me like to one more rich in hope, + +Featur’d like him, like him with friends possess’d, + +Desiring this man’s art and that man’s scope, + +With what I most enjoy contented least; + +.. idempotent translations (2 out of 14 lines): + +Yet in these thoughts myself almost despising, + +Haply I think on thee, and then my state, + +.. untranslated (2 out of 14 lines): + +Like to the lark at break of day arising + +From sullen earth, sings hymns at heaven’s gate; + +.. translation missing (2 out of 14 lines): + +For thy sweet love remember’d such wealth brings + +That then I scorn to change my state with kings. + +.. translation progress substitution + +|translation progress| diff --git a/tests/roots/test-intl/versionchange.txt b/tests/roots/test-intl/versionchange.txt new file mode 100644 index 0000000..4c57e14 --- /dev/null +++ b/tests/roots/test-intl/versionchange.txt @@ -0,0 +1,16 @@ +:tocdepth: 2 + +i18n with versionchange +============================ + +.. deprecated:: 1.0 + This is the *first* paragraph of deprecated. + + This is the *second* paragraph of deprecated. + +.. versionadded:: 1.0 + This is the *first* paragraph of versionadded. + +.. versionchanged:: 1.0 + + This is the *first* paragraph of versionchanged. diff --git a/tests/roots/test-intl/warnings.txt b/tests/roots/test-intl/warnings.txt new file mode 100644 index 0000000..a80fe18 --- /dev/null +++ b/tests/roots/test-intl/warnings.txt @@ -0,0 +1,5 @@ +i18n with reST warnings +======================== + +line of ``literal`` markup. + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/admonitions.po b/tests/roots/test-intl/xx/LC_MESSAGES/admonitions.po new file mode 100644 index 0000000..f114e33 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/admonitions.po @@ -0,0 +1,84 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2013, test_intl +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-03 12:00+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Admonitions" +msgstr "ADMONITIONS" + +msgid "attention title" +msgstr "ATTENTION TITLE" + +msgid "attention body" +msgstr "ATTENTION BODY" + +msgid "caution title" +msgstr "CAUTION TITLE" + +msgid "caution body" +msgstr "CAUTION BODY" + +msgid "danger title" +msgstr "DANGER TITLE" + +msgid "danger body" +msgstr "DANGER BODY" + +msgid "error title" +msgstr "ERROR TITLE" + +msgid "error body" +msgstr "ERROR BODY" + +msgid "hint title" +msgstr "HINT TITLE" + +msgid "hint body" +msgstr "HINT BODY" + +msgid "important title" +msgstr "IMPORTANT TITLE" + +msgid "important body" +msgstr "IMPORTANT BODY" + +msgid "note title" +msgstr "NOTE TITLE" + +msgid "note body" +msgstr "NOTE BODY" + +msgid "tip title" +msgstr "TIP TITLE" + +msgid "tip body" +msgstr "TIP BODY" + +msgid "warning title" +msgstr "WARNING TITLE" + +msgid "warning body" +msgstr "WARNING BODY" + +msgid "admonition title" +msgstr "ADMONITION TITLE" + +msgid "admonition body" +msgstr "ADMONITION BODY" + +msgid "1. admonition title" +msgstr "1. ADMONITION TITLE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/bom.po b/tests/roots/test-intl/xx/LC_MESSAGES/bom.po new file mode 100644 index 0000000..c6025eb --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/bom.po @@ -0,0 +1,12 @@ +#, fuzzy +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "File with UTF-8 BOM" +msgstr "Datei mit UTF-8" + +msgid "This file has a UTF-8 \"BOM\"." +msgstr "This file has umlauts: äöü." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/definition_terms.po b/tests/roots/test-intl/xx/LC_MESSAGES/definition_terms.po new file mode 100644 index 0000000..1752dd6 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/definition_terms.po @@ -0,0 +1,47 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-01-01 05:00+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with definition terms" +msgstr "I18N WITH DEFINITION TERMS" + +msgid "Some term" +msgstr "SOME TERM" + +msgid "The corresponding definition" +msgstr "THE CORRESPONDING DEFINITION" + +msgid "Some *term* `with link `__" +msgstr "SOME *TERM* `WITH LINK `__" + +msgid "The corresponding definition #2" +msgstr "THE CORRESPONDING DEFINITION #2" + +msgid "Some **term** with" +msgstr "SOME **TERM** WITH" + +msgid "classifier1" +msgstr "CLASSIFIER1" + +msgid "classifier2" +msgstr "CLASSIFIER2" + +msgid "Some term with" +msgstr "SOME TERM WITH" + +msgid "classifier[]" +msgstr "CLASSIFIER[]" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/docfields.po b/tests/roots/test-intl/xx/LC_MESSAGES/docfields.po new file mode 100644 index 0000000..8c3b8f9 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/docfields.po @@ -0,0 +1,39 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-16 14:11+0000\n" +"PO-Revision-Date: 2012-12-18 06:14+0900\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with docfields" +msgstr "I18N WITH DOCFIELDS" + +msgid "description of parameter param" +msgstr "DESCRIPTION OF PARAMETER param" + +msgid "description of parameter foo" +msgstr "DESCRIPTION OF PARAMETER foo" + +msgid "description of parameter bar" +msgstr "DESCRIPTION OF PARAMETER bar" + +msgid "if the values are not valid" +msgstr "IF THE VALUES ARE NOT VALID" + +msgid "if the values are out of range" +msgstr "IF THE VALUES ARE OUT OF RANGE" + +msgid "a new :class:`Cls3` instance" +msgstr "A NEW :class:`Cls3` INSTANCE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/external_links.po b/tests/roots/test-intl/xx/LC_MESSAGES/external_links.po new file mode 100644 index 0000000..8c53abb --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/external_links.po @@ -0,0 +1,47 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-22 08:28+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with external links" +msgstr "EXTERNAL LINKS" + +msgid "External link to Python_." +msgstr "EXTERNAL LINK TO Python_." + +msgid "Internal link to `i18n with external links`_." +msgstr "`EXTERNAL LINKS`_ IS INTERNAL LINK." + +msgid "Inline link by `Sphinx Site `_." +msgstr "INLINE LINK BY `THE SPHINX SITE `_." + +msgid "Unnamed link__." +msgstr "UNNAMED LINK__." + +msgid "link target swapped translation" +msgstr "LINK TARGET SWAPPED TRANSLATION" + +msgid "link to external1_ and external2_." +msgstr "LINK TO external2_ AND external1_." + +msgid "link to `Sphinx Site `_ and `Python Site `_." +msgstr "LINK TO `THE PYTHON SITE `_ AND `THE SPHINX SITE `_." + +msgid "Multiple references in the same line" +msgstr "MULTIPLE REFERENCES IN THE SAME LINE" + +msgid "Link to `Sphinx Site `_, `Python Site `_, Python_, Unnamed__ and `i18n with external links`_." +msgstr "LINK TO `EXTERNAL LINKS`_, Python_, `THE SPHINX SITE `_, UNNAMED__ AND `THE PYTHON SITE `_." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/figure.po b/tests/roots/test-intl/xx/LC_MESSAGES/figure.po new file mode 100644 index 0000000..64bbdf7 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/figure.po @@ -0,0 +1,57 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-01-04 07:00+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with figure caption" +msgstr "I18N WITH FIGURE CAPTION" + +msgid "My caption of the figure" +msgstr "MY CAPTION OF THE FIGURE" + +msgid "My description paragraph1 of the figure." +msgstr "MY DESCRIPTION PARAGRAPH1 OF THE FIGURE." + +msgid "My description paragraph2 of the figure." +msgstr "MY DESCRIPTION PARAGRAPH2 OF THE FIGURE." + +msgid "figure in the block" +msgstr "FIGURE IN THE BLOCK" + +msgid "block" +msgstr "BLOCK" + +msgid "image url and alt" +msgstr "IMAGE URL AND ALT" + +msgid "img" +msgstr "IMG -> I18N" + +msgid ".. image:: img.png" +msgstr ".. image:: i18n.png" + +msgid "i18n" +msgstr "I18N -> IMG" + +msgid ".. image:: i18n.png" +msgstr ".. image:: img.png" + +msgid "image on substitution" +msgstr "IMAGE ON SUBSTITUTION" + +msgid "image under note" +msgstr "IMAGE UNDER NOTE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/footnote.po b/tests/roots/test-intl/xx/LC_MESSAGES/footnote.po new file mode 100644 index 0000000..869bf62 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/footnote.po @@ -0,0 +1,40 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-22 08:28+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with Footnote" +msgstr "I18N WITH FOOTNOTE" + +msgid "[100]_ Contents [#]_ for `i18n with Footnote`_ [ref]_ [#named]_ [*]_. " +"second footnote_ref [100]_." +msgstr "`I18N WITH FOOTNOTE`_ INCLUDE THIS CONTENTS [#named]_ [ref]_ [#]_ [100]_ [*]_. " +"SECOND FOOTNOTE_REF [100]_." + +msgid "This is a auto numbered footnote." +msgstr "THIS IS A AUTO NUMBERED FOOTNOTE." + +msgid "This is a named footnote." +msgstr "THIS IS A NAMED FOOTNOTE." + +msgid "This is a numbered footnote." +msgstr "THIS IS A NUMBERED FOOTNOTE." + +msgid "This is a auto numbered named footnote." +msgstr "THIS IS A AUTO NUMBERED NAMED FOOTNOTE." + +msgid "This is a auto symbol footnote." +msgstr "THIS IS A AUTO SYMBOL FOOTNOTE." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms.po b/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms.po new file mode 100644 index 0000000..83542f1 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms.po @@ -0,0 +1,59 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-01-29 14:10+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with glossary terms" +msgstr "I18N WITH GLOSSARY TERMS" + +msgid "Some term" +msgstr "SOME NEW TERM" + +msgid "The corresponding glossary" +msgstr "THE CORRESPONDING GLOSSARY" + +msgid "Some other term" +msgstr "SOME OTHER NEW TERM" + +msgid "The corresponding glossary #2" +msgstr "THE CORRESPONDING GLOSSARY #2" + +msgid "link to :term:`Some term`." +msgstr "LINK TO :term:`SOME NEW TERM`." + +msgid "Translated glossary should be sorted by translated terms:" +msgstr "TRANSLATED GLOSSARY SHOULD BE SORTED BY TRANSLATED TERMS:" + +msgid "BBB" +msgstr "TRANSLATED TERM XXX" + +msgid "Define BBB" +msgstr "DEFINE XXX" + +msgid "AAA" +msgstr "TRANSLATED TERM YYY" + +msgid "Define AAA" +msgstr "DEFINE YYY" + +msgid "CCC" +msgstr "TRANSLATED TERM ZZZ" + +msgid "EEE" +msgstr "VVV" + +msgid "Define CCC" +msgstr "DEFINE ZZZ" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms_inconsistency.po b/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms_inconsistency.po new file mode 100644 index 0000000..ef2bf30 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/glossary_terms_inconsistency.po @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-01-29 14:10+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with glossary terms inconsistency" +msgstr "I18N WITH GLOSSARY TERMS INCONSISTENCY" + +msgid "link to :term:`Some term` and :term:`Some other term`." +msgstr "LINK TO :term:`SOME NEW TERM`." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/index.po b/tests/roots/test-intl/xx/LC_MESSAGES/index.po new file mode 100644 index 0000000..a4646f1 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/index.po @@ -0,0 +1,29 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-16 14:11+0000\n" +"PO-Revision-Date: 2012-12-18 06:14+0900\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Table of Contents" +msgstr "TABLE OF CONTENTS" + +msgid "Hidden Toc" +msgstr "HIDDEN TOC" + +msgid "testdata for i18n" +msgstr "TESTDATA FOR I18N" + +msgid "i18n, sphinx, markup" +msgstr "I18N, SPHINX, MARKUP" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/index_entries.po b/tests/roots/test-intl/xx/LC_MESSAGES/index_entries.po new file mode 100644 index 0000000..83619b4 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/index_entries.po @@ -0,0 +1,77 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2013, foo +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: foo foo\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-01-05 18:10+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with index entries" +msgstr "" + +msgid "index target section" +msgstr "" + +msgid "this is :index:`Newsletter` target paragraph." +msgstr "THIS IS :index:`NEWSLETTER` TARGET PARAGRAPH." + +msgid "various index entries" +msgstr "" + +msgid "That's all." +msgstr "" + +msgid "Mailing List" +msgstr "MAILING LIST" + +msgid "Newsletter" +msgstr "NEWSLETTER" + +msgid "Recipients List" +msgstr "RECIPIENTS LIST" + +msgid "First" +msgstr "FIRST" + +msgid "Second" +msgstr "SECOND" + +msgid "Third" +msgstr "THIRD" + +msgid "Entry" +msgstr "ENTRY" + +msgid "See" +msgstr "SEE" + +msgid "Module" +msgstr "MODULE" + +msgid "Keyword" +msgstr "KEYWORD" + +msgid "Operator" +msgstr "OPERATOR" + +msgid "Object" +msgstr "OBJECT" + +msgid "Exception" +msgstr "EXCEPTION" + +msgid "Statement" +msgstr "STATEMENT" + +msgid "Builtin" +msgstr "BUILTIN" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/label_target.po b/tests/roots/test-intl/xx/LC_MESSAGES/label_target.po new file mode 100644 index 0000000..60d7c3e --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/label_target.po @@ -0,0 +1,66 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2013, sphinx +# This file is distributed under the same license as the sphinx package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-06-19 00:33+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "section and label" +msgstr "X SECTION AND LABEL" + +msgid "" +":ref:`implicit-target` point to ``implicit-target`` and " +"`section and label`_ point to ``section-and-label``." +msgstr "" +":ref:`implicit-target` POINT TO ``implicit-target`` AND " +"`X SECTION AND LABEL`_ POINT TO ``section-and-label``." + +msgid "explicit-target" +msgstr "X EXPLICIT-TARGET" + +msgid "" +":ref:`explicit-target` point to ``explicit-target`` and `explicit-target`_" +" point to duplicated id like ``id1``." +msgstr "" +":ref:`explicit-target` POINT TO ``explicit-target`` AND `X EXPLICIT-TARGET`_" +" POINT TO DUPLICATED ID LIKE ``id1``." + +msgid "implicit section name" +msgstr "X IMPLICIT SECTION NAME" + +msgid "`implicit section name`_ point to ``implicit-section-name``." +msgstr "`X IMPLICIT SECTION NAME`_ POINT TO ``implicit-section-name``." + +msgid "duplicated sub section" +msgstr "X DUPLICATED SUB SECTION" + +msgid "" +"`duplicated sub section`_ is broken link." +msgstr "" +"`X DUPLICATED SUB SECTION`_ IS BROKEN LINK." + +msgid "label bridged target section" +msgstr "X LABEL BRIDGED TARGET SECTION" + +msgid "`bridge label`_ is not translatable but linked to translated section title." +msgstr "X `bridge label`_ IS NOT TRANSLATABLE BUT LINKED TO TRANSLATED SECTION TITLE." + +msgid "" +"`bridge label2`_ point to ``section and label`` and `bridge label`_ point to " +"``label bridged target section``. The second appeared `bridge label2`_ point " +"to correct target." +msgstr "" +"X `bridge label`_ POINT TO ``LABEL BRIDGED TARGET SECTION`` AND " +"`bridge label2`_ POINT TO ``SECTION AND LABEL``. THE SECOND APPEARED " +"`bridge label2`_ POINT TO CORRECT TARGET." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po b/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po new file mode 100644 index 0000000..8d3e5d8 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po @@ -0,0 +1,103 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-22 08:28+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with literal block" +msgstr "I18N WITH LITERAL BLOCK" + +msgid "Correct literal block::" +msgstr "CORRECT LITERAL BLOCK::" + +msgid "Missing literal block::" +msgstr "MISSING LITERAL BLOCK::" + +msgid "That's all." +msgstr "THAT'S ALL." + +msgid "included raw.txt" +msgstr "INCLUDED RAW.TXT" + +msgid "code blocks" +msgstr "CODE-BLOCKS" + +msgid "" +"def main\n" +" 'result'\n" +"end" +msgstr "" +"def main\n" +" 'RESULT'\n" +"end" + +msgid "example of C language" +msgstr "EXAMPLE OF C LANGUAGE" + +msgid "" +"#include \n" +"int main(int argc, char** argv)\n" +"{\n" +" return 0;\n" +"}" +msgstr "" +"#include \n" +"int main(int ARGC, char** ARGV)\n" +"{\n" +" return 0;\n" +"}" + +msgid "" +"#include \n" +"int main(int argc, char** argv)\n" +"{\n" +" return 0;\n" +"}" +msgstr "" +"#include \n" +"int main(int ARGC, char** ARGV)\n" +"{\n" +" return 0;\n" +"}" + +msgid "literal-block\n" +"in list" +msgstr "LITERAL-BLOCK\n" +"IN LIST" + +msgid "test_code_for_noqa()\n" +"continued()" +msgstr "" +"# TRAILING noqa SHOULD NOT GET STRIPPED\n" +"# FROM THIS BLOCK. #noqa" + +msgid "doctest blocks" +msgstr "DOCTEST-BLOCKS" + +msgid "" +">>> import sys # sys importing\n" +">>> def main(): # define main function\n" +"... sys.stdout.write('hello') # call write method of stdout object\n" +">>>\n" +">>> if __name__ == '__main__': # if run this py file as python script\n" +"... main() # call main" +msgstr "" +">>> import sys # SYS IMPORTING\n" +">>> def main(): # DEFINE MAIN FUNCTION\n" +"... sys.stdout.write('hello') # CALL WRITE METHOD OF STDOUT OBJECT\n" +">>>\n" +">>> if __name__ == '__main__': # IF RUN THIS PY FILE AS PYTHON SCRIPT\n" +"... main() # CALL MAIN" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/noqa.po b/tests/roots/test-intl/xx/LC_MESSAGES/noqa.po new file mode 100644 index 0000000..1af66b4 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/noqa.po @@ -0,0 +1,46 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) +# This file is distributed under the same license as the Sphinx intl package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-01-16 15:23+0100\n" +"PO-Revision-Date: 2022-01-16 15:23+0100\n" +"Last-Translator: Jean Abou Samra \n" +"Language-Team: \n" +"Language: xx\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.0\n" + +#: ../tests/roots/test-intl/noqa.txt:2 +msgid "First section" +msgstr "FIRST SECTION" + +#: ../tests/roots/test-intl/noqa.txt:4 +msgid "Some text with a reference, :ref:`next-section`." +msgstr "TRANSLATED TEXT WITHOUT REFERENCE. #noqa" + +#: ../tests/roots/test-intl/noqa.txt:6 +msgid "Another reference: :ref:`next-section`." +msgstr "" +"TEST noqa WHITESPACE INSENSITIVITY.\n" +"# \n" +" noqa" + +#: ../tests/roots/test-intl/noqa.txt:8 +msgid "This should allow to test escaping ``#noqa``." +msgstr "``#noqa`` IS ESCAPED AT THE END OF THIS STRING. \\#noqa" + +#: ../tests/roots/test-intl/noqa.txt:13 +msgid "Next section" +msgstr "NEXT SECTION WITH PARAGRAPH TO TEST BARE noqa" + +# This edge case should not fail. +#: ../tests/roots/test-intl/noqa.txt:15 +msgid "Some text, again referring to the section: :ref:`next-section`." +msgstr "#noqa" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/only.po b/tests/roots/test-intl/xx/LC_MESSAGES/only.po new file mode 100644 index 0000000..43eb7d6 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/only.po @@ -0,0 +1,29 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-04 13:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Only directive" +msgstr "ONLY DIRECTIVE" + +msgid "In HTML." +msgstr "IN HTML." + +msgid "In LaTeX." +msgstr "IN LATEX." + +msgid "In both." +msgstr "IN BOTH." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/raw.po b/tests/roots/test-intl/xx/LC_MESSAGES/raw.po new file mode 100644 index 0000000..f2e8893 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/raw.po @@ -0,0 +1,21 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2015, dev +# This file is distributed under the same license as the 1235 package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: 1235 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-02-22 15:22+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "" +msgstr "" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/refs.po b/tests/roots/test-intl/xx/LC_MESSAGES/refs.po new file mode 100644 index 0000000..510a5a7 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/refs.po @@ -0,0 +1,85 @@ +# +msgid "" +msgstr "" +"Project-Id-Version: 1191 1.3\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-08-08 15:31+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Translation Tips" +msgstr "X TIPS" + +msgid "A-1. Here's how you can `download Sphinx`_." +msgstr "A-1. HERE'S HOW YOU CAN `download Sphinx`_." + +msgid "A-2. Here's how you can `download Sphinx`_." +msgstr "A-2. HERE'S HOW YOU CAN `A1 DOWNLOAD SPHINX`_." + +msgid "A-3. Here's how you can `download Sphinx`_." +msgstr "" +"A-3. HERE'S HOW YOU CAN `A3 DOWNLOAD SPHINX `_ AND `A3 DOWNLOAD " +"SPHINX `_." + +msgid "B-1. `Docutils site`_ and `Sphinx site`_." +msgstr "B-1. `Docutils site`_ and `Sphinx site`_." + +msgid "B-2. `Docutils site`_ and `Sphinx site`_." +msgstr "B-2. `B1 DOCUTILS SITE`_ AND `B1 SPHINX SITE`_." + +msgid "B-3. `Docutils site`_ and `Sphinx site`_." +msgstr "B-3. `B2 SPHINX SITE`_ AND `B2 DOCUTILS SITE`_." + +msgid "B-4. `Docutils site`_ and `Sphinx site`_." +msgstr "" +"B-4. `B4 SPHINX SITE `_ AND `B4 DOCUTILS SITE `_." + +msgid "B-5. `Docutils site`_ and `Sphinx site`_." +msgstr "" +"B-5. `B5 SPHINX SITE `_ AND `B5 DOCUTILS SITE `_\" AND `B5 SPHINX SITE `_." + +msgid "C-1. Link to `Translation Tips`_ section." +msgstr "C-1. LINK TO `Translation Tips`_ SECTION." + +msgid "C-2. Link to `Translation Tips`_ section." +msgstr "C-2. LINK TO `X TIPS`_ SECTION." + +msgid "C-3. Link to `Translation Tips`_ section." +msgstr "C-3. LINK TO `X TIPS `_ SECTION." + +msgid "C-4. Link to `Translation Tips`_ section." +msgstr "" +"C-4. LINK TO `X TIPS `_ x `X TIPS `_ " +"SECTION." + +msgid "C-5. Link to `Translation Tips`_ section." +msgstr "" +"C-5. LINK TO `TRANS `_ x `LATION `_ " + +msgid "D-1. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "D-1. LINK TO `Translation Tips`_ and `Next Section`_ SECTION." + +msgid "D-2. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "D-2. LINK TO `X TIPS`_ AND `N SECTION`_ SECTION." + +msgid "D-3. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "D-3. LINK TO `N SECTION`_ AND `X TIPS`_ SECTION." + +msgid "D-4. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "" +"D-4. LINK TO `N SECTION `_ AND `X TIPS `_ " +"SECTION." + +msgid "D-5. Link to `Translation Tips`_ and `Next Section`_ section." +msgstr "" +"D-5. LINK TO `Next `_ AND `Tips `_ " + +msgid "Next Section" +msgstr "N SECTION" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/refs_inconsistency.po b/tests/roots/test-intl/xx/LC_MESSAGES/refs_inconsistency.po new file mode 100644 index 0000000..9d8d13f --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/refs_inconsistency.po @@ -0,0 +1,39 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-05 08:28+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with refs inconsistency" +msgstr "I18N WITH REFS INCONSISTENCY" + +msgid "[100]_ for [#]_ citation [ref2]_." +msgstr "FOR CITATION [ref3]_." + +msgid "for reference_." +msgstr "reference_ FOR reference_." + +msgid "normal text." +msgstr "ORPHAN REFERENCE: `I18N WITH REFS INCONSISTENCY`_." + +msgid "This is a auto numbered footnote." +msgstr "THIS IS A AUTO NUMBERED FOOTNOTE." + +msgid "This is a citation." +msgstr "THIS IS A CITATION." + +msgid "This is a numbered footnote." +msgstr "THIS IS A NUMBERED FOOTNOTE." + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/refs_python_domain.po b/tests/roots/test-intl/xx/LC_MESSAGES/refs_python_domain.po new file mode 100644 index 0000000..bed87c4 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/refs_python_domain.po @@ -0,0 +1,25 @@ +# +msgid "" +msgstr "" +"Project-Id-Version: issue1363 1363\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-03-16 19:34+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ..\..\index.rst:4 +msgid "i18n with python domain refs" +msgstr "I18N WITH PYTHON DOMAIN REFS" + +#: ..\..\index.rst:8 +msgid "See this decorator: :func:`sensitive_variables`." +msgstr "SEE THIS DECORATOR: :func:`sensitive_variables`." + +#: ..\..\index.rst:12 +msgid "Some description" +msgstr "SOME DESCRIPTION" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/role_xref.po b/tests/roots/test-intl/xx/LC_MESSAGES/role_xref.po new file mode 100644 index 0000000..96d821f --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/role_xref.po @@ -0,0 +1,47 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-04 14:00+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n role xref" +msgstr "I18N ROCK'N ROLE XREF" + +msgid "link to :term:`Some term`, :ref:`i18n-role-xref`, :doc:`index`." +msgstr "LINK TO :ref:`i18n-role-xref`, :doc:`index`, :term:`SOME NEW TERM`." + +msgid "same type links" +msgstr "SAME TYPE LINKS" + +msgid "link to :term:`Some term` and :term:`Some other term`." +msgstr "LINK TO :term:`SOME OTHER NEW TERM` AND :term:`SOME NEW TERM`." + +msgid "link to :ref:`i18n-role-xref`, :ref:`same-type-links` and :ref:`label `." +msgstr "LINK TO :ref:`LABEL ` AND :ref:`same-type-links` AND :ref:`same-type-links`." + +msgid "link to :doc:`index` and :doc:`glossary_terms`." +msgstr "LINK TO :doc:`glossary_terms` AND :doc:`index`." + +msgid "link to :option:`-m` and :option:`--module`." +msgstr "LINK TO :option:`--module` AND :option:`-m`." + +msgid "link to :envvar:`env1` and :envvar:`env2`." +msgstr "LINK TO :envvar:`env2` AND :envvar:`env1`." + +msgid "link to :token:`token1` and :token:`token2`." +msgstr "LINK TO :token:`token2` AND :token:`token1`." + +msgid "link to :keyword:`i18n-role-xref` and :keyword:`same-type-links`." +msgstr "LINK TO :keyword:`same-type-links` AND :keyword:`i18n-role-xref`." diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/rubric.po b/tests/roots/test-intl/xx/LC_MESSAGES/rubric.po new file mode 100644 index 0000000..9137623 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/rubric.po @@ -0,0 +1,29 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-12 07:00+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with rubric" +msgstr "I18N WITH RUBRIC" + +msgid "rubric title" +msgstr "RUBRIC TITLE" + +msgid "rubric in the block" +msgstr "RUBRIC IN THE BLOCK" + +msgid "block" +msgstr "BLOCK" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/section.po b/tests/roots/test-intl/xx/LC_MESSAGES/section.po new file mode 100644 index 0000000..4af349c --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/section.po @@ -0,0 +1,28 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2018, dev +# This file is distributed under the same license as the sphinx package. +# FIRST AUTHOR , 2018. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-05-06 16:44+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.4.0\n" + +msgid "1. Section" +msgstr "1. SECTION" + +msgid "2. Sub Section" +msgstr "2. SUB SECTION" + +msgid "3. Contents Title" +msgstr "3. CONTENTS TITLE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/seealso.po b/tests/roots/test-intl/xx/LC_MESSAGES/seealso.po new file mode 100644 index 0000000..86a1c73 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/seealso.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-16 06:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with seealso" +msgstr "I18N WITH SEEALSO" + +msgid "short text 1" +msgstr "SHORT TEXT 1" + +msgid "long text 1" +msgstr "LONG TEXT 1" + +msgid "short text 2" +msgstr "SHORT TEXT 2" + +msgid "long text 2" +msgstr "LONG TEXT 2" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/sphinx.po b/tests/roots/test-intl/xx/LC_MESSAGES/sphinx.po new file mode 100644 index 0000000..a236f2f --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/sphinx.po @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2012, foof +# This file is distributed under the same license as the foo package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-11-22 08:28+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Welcome" +msgstr "WELCOME" + +msgid "Sphinx %(version)s" +msgstr "SPHINX %(version)s" diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/table.po b/tests/roots/test-intl/xx/LC_MESSAGES/table.po new file mode 100644 index 0000000..d8ffd35 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/table.po @@ -0,0 +1,54 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-16 06:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with table" +msgstr "I18N WITH TABLE" + +msgid "table caption" +msgstr "TABLE CAPTION" + +msgid "header1" +msgstr "HEADER1" + +msgid "header2" +msgstr "HEADER2" + +msgid "text1" +msgstr "TEXT1" + +msgid "text2" +msgstr "TEXT2" + +msgid "text3" +msgstr "TEXT3" + +msgid "text1" +msgstr "TEXT1" + +msgid "text4" +msgstr "TEXT4" + +msgid "text5" +msgstr "TEXT5" + +msgid "text6" +msgstr "TEXT6" + +msgid "1. table caption" +msgstr "1. TABLE CAPTION" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/toctree.po b/tests/roots/test-intl/xx/LC_MESSAGES/toctree.po new file mode 100644 index 0000000..62cccdf --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/toctree.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) +# This file is distributed under the same license as the Sphinx intl package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx intl 2013.120\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-11-01 10:24+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../toctree.txt:4 +msgid "figure" +msgstr "FIGURE" + +#: ../../toctree.txt:4 +#: ../../toctree.txt:4 +msgid "caption" +msgstr "CAPTION" + +#: ../../toctree.txt:2 +msgid "i18n with toctree" +msgstr "I18N WITH TOCTREE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/topic.po b/tests/roots/test-intl/xx/LC_MESSAGES/topic.po new file mode 100644 index 0000000..53ecb0d --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/topic.po @@ -0,0 +1,31 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2018, dev +# This file is distributed under the same license as the sphinx package. +# FIRST AUTHOR , 2018. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-05-06 16:44+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.4.0\n" + +msgid "i18n with topic" +msgstr "I18N WITH TOPIC" + +msgid "Topic Title" +msgstr "TOPIC TITLE" + +msgid "Topic Content" +msgstr "TOPIC CONTENT" + +msgid "1. Topic Title" +msgstr "1. TOPIC TITLE" + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/translation_progress.po b/tests/roots/test-intl/xx/LC_MESSAGES/translation_progress.po new file mode 100644 index 0000000..94673d1 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/translation_progress.po @@ -0,0 +1,57 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2000-01-01 00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: \n" +"Language: xx\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Translation Progress" +msgstr "TRANSLATION PROGRESS" + +msgid "When, in disgrace with fortune and men’s eyes," +msgstr "WHEN, IN DISGRACE WITH FORTUNE AND MEN’S EYES," + +msgid "I all alone beweep my outcast state," +msgstr "I ALL ALONE BEWEEP MY OUTCAST STATE," + +msgid "And trouble deaf heaven with my bootless cries," +msgstr "AND TROUBLE DEAF HEAVEN WITH MY BOOTLESS CRIES," + +msgid "And look upon myself, and curse my fate," +msgstr "AND LOOK UPON MYSELF, AND CURSE MY FATE," + +msgid "Wishing me like to one more rich in hope," +msgstr "WISHING ME LIKE TO ONE MORE RICH IN HOPE," + +msgid "Featur’d like him, like him with friends possess’d," +msgstr "FEATUR’D LIKE HIM, LIKE HIM WITH FRIENDS POSSESS’D," + +msgid "Desiring this man’s art and that man’s scope," +msgstr "DESIRING THIS MAN’S ART AND THAT MAN’S SCOPE," + +msgid "With what I most enjoy contented least;" +msgstr "WITH WHAT I MOST ENJOY CONTENTED LEAST;" + +# idempotent translations (2 out of 14 lines): + +msgid "Yet in these thoughts myself almost despising," +msgstr "Yet in these thoughts myself almost despising," + +msgid "Haply I think on thee, and then my state," +msgstr "Haply I think on thee, and then my state," + +# untranslated (2 out of 14 lines): + +msgid "Like to the lark at break of day arising" +msgstr "" + +msgid "From sullen earth, sings hymns at heaven’s gate;" +msgstr "" + +# translation missing (2 out of 14 lines): diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/versionchange.po b/tests/roots/test-intl/xx/LC_MESSAGES/versionchange.po new file mode 100644 index 0000000..5a8df38 --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/versionchange.po @@ -0,0 +1,33 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: sphinx 1.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2012-12-15 03:17+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with versionchange" +msgstr "I18N WITH VERSIONCHANGE" + +msgid "This is the *first* paragraph of deprecated." +msgstr "THIS IS THE *FIRST* PARAGRAPH OF DEPRECATED." + +msgid "This is the *second* paragraph of deprecated." +msgstr "THIS IS THE *SECOND* PARAGRAPH OF DEPRECATED." + +msgid "This is the *first* paragraph of versionadded." +msgstr "THIS IS THE *FIRST* PARAGRAPH OF VERSIONADDED." + +msgid "This is the *first* paragraph of versionchanged." +msgstr "THIS IS THE *FIRST* PARAGRAPH OF VERSIONCHANGED." + diff --git a/tests/roots/test-intl/xx/LC_MESSAGES/warnings.po b/tests/roots/test-intl/xx/LC_MESSAGES/warnings.po new file mode 100644 index 0000000..7963a0a --- /dev/null +++ b/tests/roots/test-intl/xx/LC_MESSAGES/warnings.po @@ -0,0 +1,23 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2010, Georg Brandl & Team +# This file is distributed under the same license as the Sphinx package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Sphinx 0.6\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-04 13:06+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with reST warnings" +msgstr "I18N WITH REST WARNINGS" + +msgid "line of ``literal`` markup." +msgstr "LINE OF ``BROKEN LITERAL MARKUP." diff --git a/tests/roots/test-intl_substitution_definitions/conf.py b/tests/roots/test-intl_substitution_definitions/conf.py new file mode 100644 index 0000000..5e43033 --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/conf.py @@ -0,0 +1,13 @@ +exclude_patterns = ['_build'] + +rst_prolog = """\ +.. |subst_prolog_1| replace:: prologue substitute text + +.. |subst_prolog_2| image:: /img.png +""" + +rst_epilog = """\ +.. |subst_epilog_1| replace:: epilogue substitute text + +.. |subst_epilog_2| image:: /i18n.png +""" diff --git a/tests/roots/test-intl_substitution_definitions/i18n.png b/tests/roots/test-intl_substitution_definitions/i18n.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-intl_substitution_definitions/i18n.png differ diff --git a/tests/roots/test-intl_substitution_definitions/img.png b/tests/roots/test-intl_substitution_definitions/img.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-intl_substitution_definitions/img.png differ diff --git a/tests/roots/test-intl_substitution_definitions/index.rst b/tests/roots/test-intl_substitution_definitions/index.rst new file mode 100644 index 0000000..9b8c155 --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/index.rst @@ -0,0 +1,10 @@ +CONTENTS +======== + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + + prolog_epilog_substitution + prolog_epilog_substitution_excluded diff --git a/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution.rst b/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution.rst new file mode 100644 index 0000000..4127ba4 --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution.rst @@ -0,0 +1,12 @@ +:tocdepth: 2 + +i18n with prologue and epilogue substitutions +============================================= + +This is content that contains |subst_prolog_1|. + +Substituted image |subst_prolog_2| here. + +This is content that contains |subst_epilog_1|. + +Substituted image |subst_epilog_2| here. diff --git a/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution_excluded.rst b/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution_excluded.rst new file mode 100644 index 0000000..0ddfc74 --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/prolog_epilog_substitution_excluded.rst @@ -0,0 +1,6 @@ +:tocdepth: 2 + +i18n without prologue and epilogue substitutions +================================================ + +This is content that does not include prologue and epilogue substitutions. diff --git a/tests/roots/test-intl_substitution_definitions/xx/LC_MESSAGES/prolog_epilog_substitution.po b/tests/roots/test-intl_substitution_definitions/xx/LC_MESSAGES/prolog_epilog_substitution.po new file mode 100644 index 0000000..3ce51fe --- /dev/null +++ b/tests/roots/test-intl_substitution_definitions/xx/LC_MESSAGES/prolog_epilog_substitution.po @@ -0,0 +1,38 @@ +msgid "" +msgstr "" +"Project-Id-Version: sphinx tests\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-07-21 12:00+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "i18n with prologue and epilogue substitutions" +msgstr "I18N WITH PROLOGUE AND EPILOGUE SUBSTITUTIONS" + +msgid "This is content that contains |subst_prolog_1|." +msgstr "THIS IS CONTENT THAT CONTAINS |subst_prolog_1|." + +msgid "Substituted image |subst_prolog_2| here." +msgstr "SUBSTITUTED IMAGE |subst_prolog_2| HERE." + +msgid "This is content that contains |subst_epilog_1|." +msgstr "THIS IS CONTENT THAT CONTAINS |subst_epilog_1|." + +msgid "Substituted image |subst_epilog_2| here." +msgstr "SUBSTITUTED IMAGE |subst_epilog_2| HERE." + +msgid "subst_prolog_2" +msgstr "SUBST_PROLOG_2 TRANSLATED" + +msgid ".. image:: /img.png" +msgstr ".. image:: /i18n.png" + +msgid "subst_epilog_2" +msgstr "SUBST_EPILOG_2 TRANSLATED" + +msgid ".. image:: /i18n.png" +msgstr ".. image:: /img.png" diff --git a/tests/roots/test-keep_warnings/conf.py b/tests/roots/test-keep_warnings/conf.py new file mode 100644 index 0000000..b7b3c31 --- /dev/null +++ b/tests/roots/test-keep_warnings/conf.py @@ -0,0 +1 @@ +keep_warnings = True diff --git a/tests/roots/test-keep_warnings/index.rst b/tests/roots/test-keep_warnings/index.rst new file mode 100644 index 0000000..1e2d597 --- /dev/null +++ b/tests/roots/test-keep_warnings/index.rst @@ -0,0 +1,2 @@ +keep_warnings +===== diff --git a/tests/roots/test-latex-babel/bar.rst b/tests/roots/test-latex-babel/bar.rst new file mode 100644 index 0000000..c1ddf30 --- /dev/null +++ b/tests/roots/test-latex-babel/bar.rst @@ -0,0 +1,4 @@ +=== +Bar +=== + diff --git a/tests/roots/test-latex-babel/conf.py b/tests/roots/test-latex-babel/conf.py new file mode 100644 index 0000000..175e3ff --- /dev/null +++ b/tests/roots/test-latex-babel/conf.py @@ -0,0 +1,5 @@ +numfig_format = { + 'figure': 'Fig. %s', + 'table': 'Table. %s', + 'code-block': 'List.', +} diff --git a/tests/roots/test-latex-babel/foo.rst b/tests/roots/test-latex-babel/foo.rst new file mode 100644 index 0000000..cecc672 --- /dev/null +++ b/tests/roots/test-latex-babel/foo.rst @@ -0,0 +1,4 @@ +=== +Foo +=== + diff --git a/tests/roots/test-latex-babel/index.rst b/tests/roots/test-latex-babel/index.rst new file mode 100644 index 0000000..7c19f9e --- /dev/null +++ b/tests/roots/test-latex-babel/index.rst @@ -0,0 +1,8 @@ +test-tocdepth +============= + +.. toctree:: + :caption: Table of content + + foo + bar diff --git a/tests/roots/test-latex-container/conf.py b/tests/roots/test-latex-container/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-latex-container/index.rst b/tests/roots/test-latex-container/index.rst new file mode 100644 index 0000000..899788b --- /dev/null +++ b/tests/roots/test-latex-container/index.rst @@ -0,0 +1,4 @@ +.. container:: classname + + text + \ No newline at end of file diff --git a/tests/roots/test-latex-equations/conf.py b/tests/roots/test-latex-equations/conf.py new file mode 100644 index 0000000..d851892 --- /dev/null +++ b/tests/roots/test-latex-equations/conf.py @@ -0,0 +1,2 @@ +root_doc = 'equations' +extensions = ['sphinx.ext.imgmath'] diff --git a/tests/roots/test-latex-equations/equations.rst b/tests/roots/test-latex-equations/equations.rst new file mode 100644 index 0000000..2eef2f2 --- /dev/null +++ b/tests/roots/test-latex-equations/equations.rst @@ -0,0 +1,21 @@ +test-latex-equation +=================== + +Equation without a label. + +.. math:: + + E = mc^2 + +Equation with label. + +.. math:: E = hv + :label: test + +Second equation without label. + +.. math:: + + c^2 = a^2 + b^2 + +Equation with label :eq:`test` is important. diff --git a/tests/roots/test-latex-equations/expects/latex-equations.tex b/tests/roots/test-latex-equations/expects/latex-equations.tex new file mode 100644 index 0000000..5374a67 --- /dev/null +++ b/tests/roots/test-latex-equations/expects/latex-equations.tex @@ -0,0 +1,18 @@ + +\sphinxAtStartPar +Equation without a label. +\begin{equation*} +\begin{split}E = mc^2\end{split} +\end{equation*} +\sphinxAtStartPar +Equation with label. +\begin{equation}\label{equation:equations:test} +\begin{split}E = hv\end{split} +\end{equation} +\sphinxAtStartPar +Second equation without label. +\begin{equation*} +\begin{split}c^2 = a^2 + b^2\end{split} +\end{equation*} +\sphinxAtStartPar +Equation with label \eqref{equation:equations:test} is important. diff --git a/tests/roots/test-latex-figure-in-admonition/conf.py b/tests/roots/test-latex-figure-in-admonition/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-latex-figure-in-admonition/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-latex-figure-in-admonition/img.png b/tests/roots/test-latex-figure-in-admonition/img.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-latex-figure-in-admonition/img.png differ diff --git a/tests/roots/test-latex-figure-in-admonition/index.rst b/tests/roots/test-latex-figure-in-admonition/index.rst new file mode 100644 index 0000000..e3d39d3 --- /dev/null +++ b/tests/roots/test-latex-figure-in-admonition/index.rst @@ -0,0 +1,9 @@ +Test Figure in Admonition +========================= + +.. caution:: + + This uses a figure in an admonition. + + .. figure:: img.png + diff --git a/tests/roots/test-latex-includegraphics/conf.py b/tests/roots/test-latex-includegraphics/conf.py new file mode 100644 index 0000000..65c19ab --- /dev/null +++ b/tests/roots/test-latex-includegraphics/conf.py @@ -0,0 +1,47 @@ +exclude_patterns = ['_build'] + +latex_elements = { + 'preamble': r''' +\makeatletter +\def\dividetwolengths#1#2{\the\dimexpr + \numexpr65536*\dimexpr#1\relax/\dimexpr#2\relax sp}% +\newwrite\out +\immediate\openout\out=\jobname-dimensions.txt +\def\toout{\immediate\write\out} +\def\getWfromoptions #1width=#2,#3\relax{\def\WidthFromOption{#2}}% +\def\getHfromoptions #1height=#2,#3\relax{\def\HeightFromOption{#2}}% +\def\tempincludegraphics[#1]#2{% + \sphinxsafeincludegraphics[#1]{#2}% + \edef\obtainedratio + {\dividetwolengths\spx@image@requiredheight\spx@image@requiredwidth}% + \getWfromoptions#1,width=,\relax + \getHfromoptions#1,height=,\relax + \def\ratiocheck{}% + \ifx\WidthFromOption\empty\else + \ifx\HeightFromOption\empty\else + \edef\askedforratio{\dividetwolengths\HeightFromOption\WidthFromOption}% + \edef\ratiocheck{\dividetwolengths\obtainedratio\askedforratio}% + \fi\fi + \toout{original options = #1^^J% + width = \the\dimexpr\spx@image@requiredwidth, + linewidth = \the\linewidth^^J% + height = \the\dimexpr\spx@image@requiredheight, + maxheight = \the\spx@image@maxheight^^J% + obtained H/W = \obtainedratio^^J% + \ifx\ratiocheck\empty + \else + asked for H/W = \askedforratio^^J% + ratio of ratios = \ratiocheck^^J% + \fi + }% + \ifx\ratiocheck\empty + \else + \ifpdfabsdim\dimexpr\ratiocheck-1pt\relax > 0.01pt + \ASPECTRATIOERROR + \fi + \fi +} +\def\sphinxincludegraphics#1#{\tempincludegraphics#1} +\makeatother +''', +} diff --git a/tests/roots/test-latex-includegraphics/img.png b/tests/roots/test-latex-includegraphics/img.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-latex-includegraphics/img.png differ diff --git a/tests/roots/test-latex-includegraphics/index.rst b/tests/roots/test-latex-includegraphics/index.rst new file mode 100644 index 0000000..920c749 --- /dev/null +++ b/tests/roots/test-latex-includegraphics/index.rst @@ -0,0 +1,37 @@ +==================== +Test image inclusion +==================== + +Tests with both width and height +-------------------------------- + +.. an image with big dimensions, ratio H/W = 1/5 +.. image:: img.png + :height: 200 + :width: 1000 + +.. topic:: Oversized images + + .. an image with big dimensions, ratio H/W = 5/1 + .. image:: img.png + :height: 1000 + :width: 200 + + .. height too big even if width reduced to linewidth, ratio H/W = 3/1 + .. image:: img.png + :width: 1000 + :height: 3000 + +Tests with only width or height +------------------------------- + +.. topic:: Oversized images + + .. tall image which does not fit in textheight even if width rescaled + .. image:: tall.png + :width: 1000 + +.. wide image which does not fit in linewidth even after height diminished +.. image:: sphinx.png + :height: 1000 + diff --git a/tests/roots/test-latex-includegraphics/sphinx.png b/tests/roots/test-latex-includegraphics/sphinx.png new file mode 100644 index 0000000..0a103cd Binary files /dev/null and b/tests/roots/test-latex-includegraphics/sphinx.png differ diff --git a/tests/roots/test-latex-includegraphics/tall.png b/tests/roots/test-latex-includegraphics/tall.png new file mode 100644 index 0000000..c98c058 Binary files /dev/null and b/tests/roots/test-latex-includegraphics/tall.png differ diff --git a/tests/roots/test-latex-index/conf.py b/tests/roots/test-latex-index/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-latex-index/index.rst b/tests/roots/test-latex-index/index.rst new file mode 100644 index 0000000..5b61279 --- /dev/null +++ b/tests/roots/test-latex-index/index.rst @@ -0,0 +1,16 @@ +test-latex-index +================ + +A :index:`famous` :index:`equation`: + +.. math:: + + E = m c^2 + +.. index:: Einstein, relativity + +and some text. + +.. index:: main { + +An index entry containing non paired curly brace diff --git a/tests/roots/test-latex-labels-before-module/automodule1.py b/tests/roots/test-latex-labels-before-module/automodule1.py new file mode 100644 index 0000000..0545aa4 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/automodule1.py @@ -0,0 +1,2 @@ +"""docstring""" + diff --git a/tests/roots/test-latex-labels-before-module/automodule2a.py b/tests/roots/test-latex-labels-before-module/automodule2a.py new file mode 100644 index 0000000..0545aa4 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/automodule2a.py @@ -0,0 +1,2 @@ +"""docstring""" + diff --git a/tests/roots/test-latex-labels-before-module/automodule2b.py b/tests/roots/test-latex-labels-before-module/automodule2b.py new file mode 100644 index 0000000..0545aa4 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/automodule2b.py @@ -0,0 +1,2 @@ +"""docstring""" + diff --git a/tests/roots/test-latex-labels-before-module/automodule3.py b/tests/roots/test-latex-labels-before-module/automodule3.py new file mode 100644 index 0000000..0545aa4 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/automodule3.py @@ -0,0 +1,2 @@ +"""docstring""" + diff --git a/tests/roots/test-latex-labels-before-module/conf.py b/tests/roots/test-latex-labels-before-module/conf.py new file mode 100644 index 0000000..25193b0 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/conf.py @@ -0,0 +1,8 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc'] + +nitpicky = True diff --git a/tests/roots/test-latex-labels-before-module/index.rst b/tests/roots/test-latex-labels-before-module/index.rst new file mode 100644 index 0000000..e6df749 --- /dev/null +++ b/tests/roots/test-latex-labels-before-module/index.rst @@ -0,0 +1,48 @@ +latex-labels-before-module +========================== + +.. _label_1a: +.. _label_1b: + +.. module:: module1 + + text + +.. _label_2: + +.. module:: module2a + + text + +.. module:: module2b + + text + +.. _label_3: + +.. module:: module3 + + text + +.. _label_auto_1a: +.. _label_auto_1b: + +.. automodule:: automodule1 + + text + +.. _label_auto_2: + +.. automodule:: automodule2a + + text + +.. automodule:: automodule2b + + text + +.. _label_auto_3: + +.. automodule:: automodule3 + + text diff --git a/tests/roots/test-latex-labels/conf.py b/tests/roots/test-latex-labels/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-latex-labels/index.rst b/tests/roots/test-latex-labels/index.rst new file mode 100644 index 0000000..f3c4217 --- /dev/null +++ b/tests/roots/test-latex-labels/index.rst @@ -0,0 +1,72 @@ +latex-labels +============ + +figures +------- + +.. _figure1: +.. _figure2: + +.. figure:: logo.jpg + + labeled figure + +.. figure:: logo.jpg + :name: figure3 + + labeled figure + + with a legend + +code-blocks +----------- + +.. _codeblock1: +.. _codeblock2: + +.. code-block:: none + + blah blah blah + +.. code-block:: none + :name: codeblock3 + + blah blah blah + +tables +------ + +.. _table1: +.. _table2: + +.. table:: table caption + + ==== ==== + head head + cell cell + ==== ==== + +.. table:: table caption + :name: table3 + + ==== ==== + head head + cell cell + ==== ==== + +.. _section1: +.. _section2: + +subsection +---------- + +.. _section3: + +subsubsection +~~~~~~~~~~~~~ + +.. toctree:: + + otherdoc + +* Embedded standalone hyperlink reference(refs: #5948): `subsection `_. diff --git a/tests/roots/test-latex-labels/otherdoc.rst b/tests/roots/test-latex-labels/otherdoc.rst new file mode 100644 index 0000000..55c5ca0 --- /dev/null +++ b/tests/roots/test-latex-labels/otherdoc.rst @@ -0,0 +1,2 @@ +otherdoc +======== diff --git a/tests/roots/test-latex-numfig/conf.py b/tests/roots/test-latex-numfig/conf.py new file mode 100644 index 0000000..287bd1c --- /dev/null +++ b/tests/roots/test-latex-numfig/conf.py @@ -0,0 +1,8 @@ +extensions = ['sphinx.ext.imgmath'] # for math_numfig + +latex_documents = [ + ('indexmanual', 'SphinxManual.tex', 'Test numfig manual', + 'Sphinx', 'manual'), + ('indexhowto', 'SphinxHowTo.tex', 'Test numfig howto', + 'Sphinx', 'howto'), +] diff --git a/tests/roots/test-latex-numfig/index.rst b/tests/roots/test-latex-numfig/index.rst new file mode 100644 index 0000000..6b8b968 --- /dev/null +++ b/tests/roots/test-latex-numfig/index.rst @@ -0,0 +1,9 @@ +================= +test-latex-numfig +================= + +.. toctree:: + :numbered: + + indexmanual + indexhowto diff --git a/tests/roots/test-latex-numfig/indexhowto.rst b/tests/roots/test-latex-numfig/indexhowto.rst new file mode 100644 index 0000000..4749f1e --- /dev/null +++ b/tests/roots/test-latex-numfig/indexhowto.rst @@ -0,0 +1,10 @@ +======================= +test-latex-numfig-howto +======================= + +This is a part +============== + +This is a section +----------------- + diff --git a/tests/roots/test-latex-numfig/indexmanual.rst b/tests/roots/test-latex-numfig/indexmanual.rst new file mode 100644 index 0000000..8bab4fb --- /dev/null +++ b/tests/roots/test-latex-numfig/indexmanual.rst @@ -0,0 +1,13 @@ +======================== +test-latex-numfig-manual +======================== + +First part +========== + +This is chapter +--------------- + +This is section +~~~~~~~~~~~~~~~ + diff --git a/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t b/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t new file mode 100644 index 0000000..e2cb1db --- /dev/null +++ b/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t @@ -0,0 +1 @@ +SALUT LES COPAINS diff --git a/tests/roots/test-latex-table/complex.rst b/tests/roots/test-latex-table/complex.rst new file mode 100644 index 0000000..d648ff1 --- /dev/null +++ b/tests/roots/test-latex-table/complex.rst @@ -0,0 +1,58 @@ +complex tables +============== + +grid table +---------- + +.. rst-class:: nocolorrows + ++---------+---------+---------+ +| header1 | header2 | header3 | ++=========+=========+=========+ +| cell1-1 | cell1-2 | cell1-3 | ++---------+ +---------+ +| cell2-1 | | cell2-3 | ++ +---------+---------+ +| | cell3-2-par1 | ++---------+ | +| cell4-1 | cell3-2-par2 | ++---------+---------+---------+ +| cell5-1 | ++---------+---------+---------+ + +grid table with tabularcolumns having no vline +---------------------------------------------- + +.. tabularcolumns:: TTT + ++---------+---------+---------+ +| header1 | header2 | header3 | ++=========+=========+=========+ +| cell1-1 | cell1-2 | cell1-3 | ++---------+ +---------+ +| cell2-1 | | cell2-3 | ++ +---------+---------+ +| | cell3-2-par1 | ++---------+ | +| cell4-1 | cell3-2-par2 | ++---------+---------+---------+ +| cell5-1 | ++---------+---------+---------+ + +complex spanning cell +--------------------- + +table having ... + +* consecutive multirow at top of row (1-1 and 1-2) +* consecutive multirow at end of row (1-4 and 1-5) + +.. rst-class:: standard + ++-----------+-----------+-----------+-----------+-----------+ +| | | cell1-3 | | | +| | +-----------+ | cell1-5 | +| cell1-1 | cell1-2 | | cell1-4 | | +| | | cell2-3 | +-----------+ +| | | | | cell3-5 | ++-----------+-----------+-----------+-----------+-----------+ diff --git a/tests/roots/test-latex-table/conf.py b/tests/roots/test-latex-table/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-latex-table/expects/complex_spanning_cell.tex b/tests/roots/test-latex-table/expects/complex_spanning_cell.tex new file mode 100644 index 0000000..d2d6189 --- /dev/null +++ b/tests/roots/test-latex-table/expects/complex_spanning_cell.tex @@ -0,0 +1,69 @@ +\label{\detokenize{complex:complex-spanning-cell}} +\sphinxAtStartPar +table having … +\begin{itemize} +\item {} +\sphinxAtStartPar +consecutive multirow at top of row (1\sphinxhyphen{}1 and 1\sphinxhyphen{}2) + +\item {} +\sphinxAtStartPar +consecutive multirow at end of row (1\sphinxhyphen{}4 and 1\sphinxhyphen{}5) + +\end{itemize} + + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithstandardstyle +\centering +\begin{tabulary}{\linewidth}[t]{|T|T|T|T|T|} +\sphinxtoprule +\sphinxtableatstartofbodyhook\sphinxmultirow{3}{1}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxmultirow{3}{2}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +& +\sphinxAtStartPar +cell1\sphinxhyphen{}3 +&\sphinxmultirow{3}{4}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell1\sphinxhyphen{}4 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxmultirow{2}{5}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell1\sphinxhyphen{}5 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +\\ +\sphinxvlinecrossing{1}\sphinxcline{3-3}\sphinxvlinecrossing{4}\sphinxfixclines{5}\sphinxtablestrut{1}&\sphinxtablestrut{2}&\sphinxmultirow{2}{6}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{5}} +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxtablestrut{4}&\sphinxtablestrut{5}\\ +\sphinxvlinecrossing{1}\sphinxvlinecrossing{2}\sphinxvlinecrossing{3}\sphinxcline{5-5}\sphinxfixclines{5}\sphinxtablestrut{1}&\sphinxtablestrut{2}&\sphinxtablestrut{6}&\sphinxtablestrut{4}& +\sphinxAtStartPar +cell3\sphinxhyphen{}5 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/gridtable.tex b/tests/roots/test-latex-table/expects/gridtable.tex new file mode 100644 index 0000000..407abe7 --- /dev/null +++ b/tests/roots/test-latex-table/expects/gridtable.tex @@ -0,0 +1,73 @@ +\label{\detokenize{complex:grid-table}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithnocolorrowsstyle +\centering +\begin{tabulary}{\linewidth}[t]{|T|T|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +&\sphinxmultirow{2}{5}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{3}} +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +& +\sphinxAtStartPar +cell1\sphinxhyphen{}3 +\\ +\sphinxcline{1-1}\sphinxcline{3-3}\sphinxfixclines{3}\sphinxmultirow{2}{7}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{3}} +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxtablestrut{5}& +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\\ +\sphinxcline{2-3}\sphinxfixclines{3}\sphinxtablestrut{7}&\sphinxstartmulticolumn{2}% +\sphinxmultirow{2}{9}{% +\begin{varwidth}[t]{\sphinxcolwidth{2}{3}} +\sphinxAtStartPar +cell3\sphinxhyphen{}2\sphinxhyphen{}par1 + +\sphinxAtStartPar +cell3\sphinxhyphen{}2\sphinxhyphen{}par2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +\sphinxstopmulticolumn +\\ +\sphinxcline{1-1}\sphinxfixclines{3} +\sphinxAtStartPar +cell4\sphinxhyphen{}1 +&\multicolumn{2}{l|}{\sphinxtablestrut{9}}\\ +\sphinxhline\sphinxstartmulticolumn{3}% +\begin{varwidth}[t]{\sphinxcolwidth{3}{3}} +\sphinxAtStartPar +cell5\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +\sphinxstopmulticolumn +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex b/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex new file mode 100644 index 0000000..c77b990 --- /dev/null +++ b/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex @@ -0,0 +1,73 @@ +\label{\detokenize{complex:grid-table-with-tabularcolumns-having-no-vline}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithnovlinesstyle +\centering +\begin{tabulary}{\linewidth}[t]{TTT} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +&\sphinxmultirow{2}{5}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{3}} +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +& +\sphinxAtStartPar +cell1\sphinxhyphen{}3 +\\ +\sphinxcline{1-1}\sphinxcline{3-3}\sphinxfixclines{3}\sphinxmultirow{2}{7}{% +\begin{varwidth}[t]{\sphinxcolwidth{1}{3}} +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +&\sphinxtablestrut{5}& +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\\ +\sphinxcline{2-3}\sphinxfixclines{3}\sphinxtablestrut{7}&\sphinxstartmulticolumn{2}% +\sphinxmultirow{2}{9}{% +\begin{varwidth}[t]{\sphinxcolwidth{2}{3}} +\sphinxAtStartPar +cell3\sphinxhyphen{}2\sphinxhyphen{}par1 + +\sphinxAtStartPar +cell3\sphinxhyphen{}2\sphinxhyphen{}par2 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +}% +\sphinxstopmulticolumn +\\ +\sphinxcline{1-1}\sphinxfixclines{3} +\sphinxAtStartPar +cell4\sphinxhyphen{}1 +&\multicolumn{2}{l}{\sphinxtablestrut{9}}\\ +\sphinxhline\sphinxstartmulticolumn{3}% +\begin{varwidth}[t]{\sphinxcolwidth{3}{3}} +\sphinxAtStartPar +cell5\sphinxhyphen{}1 +\par +\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}% +\sphinxstopmulticolumn +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/longtable.tex b/tests/roots/test-latex-table/expects/longtable.tex new file mode 100644 index 0000000..1fe1022 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable.tex @@ -0,0 +1,70 @@ +\label{\detokenize{longtable:longtable}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithborderlessstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{ll} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\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 new file mode 100644 index 0000000..4a4df18 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_align.tex @@ -0,0 +1,69 @@ +\label{\detokenize{longtable:longtable-having-align-option}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax +\makeatother +\begin{longtable}{|l|l|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\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 new file mode 100644 index 0000000..a1aa65d --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_caption.tex @@ -0,0 +1,71 @@ +\label{\detokenize{longtable:longtable-having-caption}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|l|l|} +\sphinxthelongtablecaptionisattop +\caption{caption for longtable\strut}\label{\detokenize{longtable:id1}}\\*[\sphinxlongtablecapskipadjust] +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\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 new file mode 100644 index 0000000..240a760 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex @@ -0,0 +1,76 @@ +\label{\detokenize{longtable:longtable-having-problematic-cell}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|*{2}{\X{1}{2}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook +\begin{itemize} +\item {} +\sphinxAtStartPar +item1 + +\item {} +\sphinxAtStartPar +item2 + +\end{itemize} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\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 new file mode 100644 index 0000000..897830b --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex @@ -0,0 +1,81 @@ +\label{\detokenize{longtable:longtable-having-both-stub-columns-and-problematic-cell}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|*{3}{\X{1}{3}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{3}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{3}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook +\sphinxstyletheadfamily \begin{itemize} +\item {} +\sphinxAtStartPar +instub1\sphinxhyphen{}1a + +\item {} +\sphinxAtStartPar +instub1\sphinxhyphen{}1b + +\end{itemize} +&\sphinxstyletheadfamily +\sphinxAtStartPar +instub1\sphinxhyphen{}2 +& +\sphinxAtStartPar +notinstub1\sphinxhyphen{}3 +\\ +\sphinxhline\sphinxstyletheadfamily +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\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 new file mode 100644 index 0000000..b9f7512 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex @@ -0,0 +1,70 @@ +\label{\detokenize{longtable:longtable-having-verbatim}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|*{2}{\X{1}{2}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\begin{sphinxVerbatimintable}[commandchars=\\\{\}] +\PYG{n}{hello} \PYG{n}{world} +\end{sphinxVerbatimintable} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\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 new file mode 100644 index 0000000..24dad79 --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_widths.tex @@ -0,0 +1,73 @@ +\label{\detokenize{longtable:longtable-having-widths-option}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|\X{30}{100}|\X{70}{100}|} +\noalign{\phantomsection\label{\detokenize{longtable:namedlongtable}}\label{\detokenize{longtable:mylongtable}}}% +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\sphinxatlongtableend +\end{savenotes} + +\sphinxAtStartPar +See {\hyperref[\detokenize{longtable:mylongtable}]{\sphinxcrossref{mylongtable}}}, same as {\hyperref[\detokenize{longtable:namedlongtable}]{\sphinxcrossref{\DUrole{std,std-ref}{this one}}}}. 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 new file mode 100644 index 0000000..b4758ca --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex @@ -0,0 +1,76 @@ +\label{\detokenize{longtable:longtable-having-both-widths-and-problematic-cell}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|\X{30}{100}|\X{70}{100}|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook +\begin{itemize} +\item {} +\sphinxAtStartPar +item1 + +\item {} +\sphinxAtStartPar +item2 + +\end{itemize} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\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 new file mode 100644 index 0000000..4c380fe --- /dev/null +++ b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex @@ -0,0 +1,70 @@ +\label{\detokenize{longtable:longtable-with-tabularcolumn}} + +\begin{savenotes} +\sphinxatlongtablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithvlinesstyle +\makeatletter + \LTleft \@totalleftmargin plus1fill + \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill +\makeatother +\begin{longtable}{|c|c|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endfirsthead + +\multicolumn{2}{c}{\sphinxnorowcolor + \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}% +}\\ +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\endhead + +\sphinxbottomrule +\multicolumn{2}{r}{\sphinxnorowcolor + \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}% +}\\ +\endfoot + +\endlastfoot +\sphinxtableatstartofbodyhook + +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{longtable} +\sphinxtableafterendhook +\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 new file mode 100644 index 0000000..7bd85c7 --- /dev/null +++ b/tests/roots/test-latex-table/expects/simple_table.tex @@ -0,0 +1,40 @@ +\label{\detokenize{tabular:simple-table}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabulary}{\linewidth}[t]{|T|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_caption.tex b/tests/roots/test-latex-table/expects/table_having_caption.tex new file mode 100644 index 0000000..f2ce553 --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_caption.tex @@ -0,0 +1,44 @@ +\label{\detokenize{tabular:table-having-caption}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\sphinxcapstartof{table} +\sphinxthecaptionisattop +\sphinxcaption{caption for table}\label{\detokenize{tabular:id1}} +\sphinxaftertopcaption +\begin{tabulary}{\linewidth}[t]{|T|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} 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 new file mode 100644 index 0000000..7d7ad4b --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex @@ -0,0 +1,47 @@ +\label{\detokenize{tabular:table-having-problematic-cell}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabular}[t]{|*{2}{\X{1}{2}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook\begin{itemize} +\item {} +\sphinxAtStartPar +item1 + +\item {} +\sphinxAtStartPar +item2 + +\end{itemize} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} 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 new file mode 100644 index 0000000..fbd797a --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex @@ -0,0 +1,49 @@ +\label{\detokenize{tabular:table-having-both-stub-columns-and-problematic-cell}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabular}[t]{|*{3}{\X{1}{3}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header3 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook\sphinxstyletheadfamily \begin{itemize} +\item {} +\sphinxAtStartPar +instub1\sphinxhyphen{}1a + +\item {} +\sphinxAtStartPar +instub1\sphinxhyphen{}1b + +\end{itemize} +&\sphinxstyletheadfamily +\sphinxAtStartPar +instub1\sphinxhyphen{}2 +& +\sphinxAtStartPar +notinstub1\sphinxhyphen{}3 +\\ +\sphinxhline\sphinxstyletheadfamily +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}3 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} 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 new file mode 100644 index 0000000..9acd9a8 --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex @@ -0,0 +1,26 @@ +\label{\detokenize{tabular:table-with-cell-in-first-column-having-three-paragraphs}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabulary}{\linewidth}[t]{|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1\sphinxhyphen{}par1 + +\sphinxAtStartPar +cell1\sphinxhyphen{}1\sphinxhyphen{}par2 + +\sphinxAtStartPar +cell1\sphinxhyphen{}1\sphinxhyphen{}par3 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_verbatim.tex b/tests/roots/test-latex-table/expects/table_having_verbatim.tex new file mode 100644 index 0000000..a002de5 --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_verbatim.tex @@ -0,0 +1,41 @@ +\label{\detokenize{tabular:table-having-verbatim}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabular}[t]{|*{2}{\X{1}{2}|}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\begin{sphinxVerbatimintable}[commandchars=\\\{\}] +\PYG{n}{hello} \PYG{n}{world} +\end{sphinxVerbatimintable} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/table_having_widths.tex b/tests/roots/test-latex-table/expects/table_having_widths.tex new file mode 100644 index 0000000..fe5f4c4 --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_widths.tex @@ -0,0 +1,46 @@ +\label{\detokenize{tabular:table-having-widths-option}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithbooktabsstyle +\sphinxthistablewithcolorrowsstyle +\centering +\phantomsection\label{\detokenize{tabular:namedtabular}}\label{\detokenize{tabular:mytabular}}\nobreak +\begin{tabular}[t]{\X{30}{100}\X{70}{100}} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} + +\sphinxAtStartPar +See {\hyperref[\detokenize{tabular:mytabular}]{\sphinxcrossref{\DUrole{std,std-ref}{this}}}}, same as {\hyperref[\detokenize{tabular:namedtabular}]{\sphinxcrossref{namedtabular}}}. 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 new file mode 100644 index 0000000..1baf92c --- /dev/null +++ b/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex @@ -0,0 +1,47 @@ +\label{\detokenize{tabular:table-having-both-widths-and-problematic-cell}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\centering +\begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook\begin{itemize} +\item {} +\sphinxAtStartPar +item1 + +\item {} +\sphinxAtStartPar +item2 + +\end{itemize} +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/tabular_having_widths.tex b/tests/roots/test-latex-table/expects/tabular_having_widths.tex new file mode 100644 index 0000000..15321d6 --- /dev/null +++ b/tests/roots/test-latex-table/expects/tabular_having_widths.tex @@ -0,0 +1,40 @@ +\label{\detokenize{tabular:table-having-align-option-tabular}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\raggedright +\begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabular} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/tabularcolumn.tex b/tests/roots/test-latex-table/expects/tabularcolumn.tex new file mode 100644 index 0000000..fcb01be --- /dev/null +++ b/tests/roots/test-latex-table/expects/tabularcolumn.tex @@ -0,0 +1,41 @@ +\label{\detokenize{tabular:table-with-tabularcolumn}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\sphinxthistablewithnovlinesstyle +\centering +\begin{tabulary}{\linewidth}[t]{cc} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/expects/tabulary_having_widths.tex b/tests/roots/test-latex-table/expects/tabulary_having_widths.tex new file mode 100644 index 0000000..2463416 --- /dev/null +++ b/tests/roots/test-latex-table/expects/tabulary_having_widths.tex @@ -0,0 +1,40 @@ +\label{\detokenize{tabular:table-having-align-option-tabulary}} + +\begin{savenotes}\sphinxattablestart +\sphinxthistablewithglobalstyle +\raggedleft +\begin{tabulary}{\linewidth}[t]{|T|T|} +\sphinxtoprule +\sphinxstyletheadfamily +\sphinxAtStartPar +header1 +&\sphinxstyletheadfamily +\sphinxAtStartPar +header2 +\\ +\sphinxmidrule +\sphinxtableatstartofbodyhook +\sphinxAtStartPar +cell1\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell1\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell2\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell2\sphinxhyphen{}2 +\\ +\sphinxhline +\sphinxAtStartPar +cell3\sphinxhyphen{}1 +& +\sphinxAtStartPar +cell3\sphinxhyphen{}2 +\\ +\sphinxbottomrule +\end{tabulary} +\sphinxtableafterendhook\par +\sphinxattableend\end{savenotes} diff --git a/tests/roots/test-latex-table/index.rst b/tests/roots/test-latex-table/index.rst new file mode 100644 index 0000000..80dd110 --- /dev/null +++ b/tests/roots/test-latex-table/index.rst @@ -0,0 +1,8 @@ +test-latex-table +================ + +.. toctree:: + + tabular + longtable + complex diff --git a/tests/roots/test-latex-table/longtable.rst b/tests/roots/test-latex-table/longtable.rst new file mode 100644 index 0000000..da6fa5c --- /dev/null +++ b/tests/roots/test-latex-table/longtable.rst @@ -0,0 +1,156 @@ +longtables +========== + +longtable +--------- + +.. table:: + :class: longtable, borderless + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +longtable having :widths: option +-------------------------------- + +.. _mylongtable: + +.. table:: + :class: longtable + :widths: 30,70 + :name: namedlongtable + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +See mylongtable_, same as :ref:`this one `. + +longtable having :align: option +------------------------------- + +.. table:: + :align: right + :class: longtable + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +longtable with tabularcolumn +---------------------------- + +.. tabularcolumns:: |c|c| + +.. table:: + :class: longtable + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +longtable having caption +------------------------ + +.. list-table:: caption for longtable + :class: longtable + :header-rows: 1 + + * - header1 + - header2 + * - cell1-1 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +longtable having verbatim +------------------------- + +.. list-table:: + :class: longtable + :header-rows: 1 + + * - header1 + - header2 + * - :: + + hello world + + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +longtable having both :widths: and problematic cell +--------------------------------------------------- + +.. list-table:: + :class: longtable + :header-rows: 1 + :widths: 30,70 + + * - header1 + - header2 + * - + item1 + + item2 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +longtable having problematic cell +--------------------------------- + +.. list-table:: + :class: longtable + :header-rows: 1 + + * - header1 + - header2 + * - + item1 + + item2 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +longtable having both stub columns and problematic cell +------------------------------------------------------- + +.. list-table:: + :class: longtable + :header-rows: 1 + :stub-columns: 2 + + * - header1 + - header2 + - header3 + * - + instub1-1a + + instub1-1b + - instub1-2 + - notinstub1-3 + * - cell2-1 + - cell2-2 + - cell2-3 diff --git a/tests/roots/test-latex-table/tabular.rst b/tests/roots/test-latex-table/tabular.rst new file mode 100644 index 0000000..15db823 --- /dev/null +++ b/tests/roots/test-latex-table/tabular.rst @@ -0,0 +1,173 @@ +tabular and tabulary +==================== + +simple table +------------ + +======= ======= +header1 header2 +======= ======= +cell1-1 cell1-2 +cell2-1 cell2-2 +cell3-1 cell3-2 +======= ======= + +table having :widths: option +---------------------------- + +.. _mytabular: + +.. table:: + :widths: 30,70 + :name: namedtabular + :class: booktabs, colorrows + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +See :ref:`this `, same as namedtabular_. + +table having :align: option (tabulary) +-------------------------------------- + +.. table:: + :align: right + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +table having :align: option (tabular) +------------------------------------- + +.. table:: + :align: left + :widths: 30,70 + + ======= ======= + header1 header2 + ======= ======= + cell1-1 cell1-2 + cell2-1 cell2-2 + cell3-1 cell3-2 + ======= ======= + +table with tabularcolumn +------------------------ + +.. tabularcolumns:: cc + +======= ======= +header1 header2 +======= ======= +cell1-1 cell1-2 +cell2-1 cell2-2 +cell3-1 cell3-2 +======= ======= + +table with cell in first column having three paragraphs +------------------------------------------------------- + ++--------------+ +| header1 | ++==============+ +| cell1-1-par1 | +| | +| cell1-1-par2 | +| | +| cell1-1-par3 | ++--------------+ + + +table having caption +-------------------- + +.. list-table:: caption for table + :header-rows: 1 + + * - header1 + - header2 + * - cell1-1 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +table having verbatim +--------------------- + +.. list-table:: + :header-rows: 1 + + * - header1 + - header2 + * - :: + + hello world + + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +table having both :widths: and problematic cell +----------------------------------------------- + +.. list-table:: + :header-rows: 1 + :widths: 30,70 + + * - header1 + - header2 + * - + item1 + + item2 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +table having problematic cell +----------------------------- + +.. list-table:: + :header-rows: 1 + + * - header1 + - header2 + * - + item1 + + item2 + - cell1-2 + * - cell2-1 + - cell2-2 + * - cell3-1 + - cell3-2 + +table having both stub columns and problematic cell +--------------------------------------------------- + +.. list-table:: + :header-rows: 1 + :stub-columns: 2 + + * - header1 + - header2 + - header3 + * - + instub1-1a + + instub1-1b + - instub1-2 + - notinstub1-3 + * - cell2-1 + - cell2-2 + - cell2-3 diff --git a/tests/roots/test-latex-theme/conf.py b/tests/roots/test-latex-theme/conf.py new file mode 100644 index 0000000..196307a --- /dev/null +++ b/tests/roots/test-latex-theme/conf.py @@ -0,0 +1,2 @@ +latex_theme = 'custom' +latex_theme_path = ['theme'] diff --git a/tests/roots/test-latex-theme/index.rst b/tests/roots/test-latex-theme/index.rst new file mode 100644 index 0000000..f5b1d53 --- /dev/null +++ b/tests/roots/test-latex-theme/index.rst @@ -0,0 +1,2 @@ +latex_theme +=========== diff --git a/tests/roots/test-latex-theme/theme/custom/theme.conf b/tests/roots/test-latex-theme/theme/custom/theme.conf new file mode 100644 index 0000000..ad8df26 --- /dev/null +++ b/tests/roots/test-latex-theme/theme/custom/theme.conf @@ -0,0 +1,6 @@ +[theme] +docclass = book +wrapperclass = sphinxbook +papersize = a4paper +pointsize = 12pt +toplevel_sectioning = chapter diff --git a/tests/roots/test-latex-title/conf.py b/tests/roots/test-latex-title/conf.py new file mode 100644 index 0000000..6443316 --- /dev/null +++ b/tests/roots/test-latex-title/conf.py @@ -0,0 +1,4 @@ +# set empty string to the third column to use the first section title to document title +latex_documents = [ + ('index', 'test.tex', '', 'Sphinx', 'report') +] diff --git a/tests/roots/test-latex-title/index.rst b/tests/roots/test-latex-title/index.rst new file mode 100644 index 0000000..411ad00 --- /dev/null +++ b/tests/roots/test-latex-title/index.rst @@ -0,0 +1,12 @@ +.. admonition:: Notice + + This generates nodes.title node before first section title. + +test-latex-title +================ + +.. toctree:: + :numbered: + + foo + bar diff --git a/tests/roots/test-latex-unicode/conf.py b/tests/roots/test-latex-unicode/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-latex-unicode/index.rst b/tests/roots/test-latex-unicode/index.rst new file mode 100644 index 0000000..2abeca9 --- /dev/null +++ b/tests/roots/test-latex-unicode/index.rst @@ -0,0 +1,7 @@ +test-latex-unicode +================== + +* script small e: ℯ +* double struck italic small i: ⅈ +* superscript: ⁰, ¹ +* subscript: ₀, ₁ diff --git a/tests/roots/test-linkcheck-anchors-ignore-for-url/conf.py b/tests/roots/test-linkcheck-anchors-ignore-for-url/conf.py new file mode 100644 index 0000000..0005bfa --- /dev/null +++ b/tests/roots/test-linkcheck-anchors-ignore-for-url/conf.py @@ -0,0 +1,3 @@ +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-anchors-ignore-for-url/index.rst b/tests/roots/test-linkcheck-anchors-ignore-for-url/index.rst new file mode 100644 index 0000000..df287b4 --- /dev/null +++ b/tests/roots/test-linkcheck-anchors-ignore-for-url/index.rst @@ -0,0 +1,7 @@ +* `Example valid url, no anchor `_ +* `Example valid url, valid anchor `_ +* `Example valid url, invalid anchor `_ +* `Example ignored url, no anchor `_ +* `Example ignored url, invalid anchor `_ +* `Example invalid url, no anchor `_ +* `Example invalid url, invalid anchor `_ diff --git a/tests/roots/test-linkcheck-anchors-ignore/conf.py b/tests/roots/test-linkcheck-anchors-ignore/conf.py new file mode 100644 index 0000000..0005bfa --- /dev/null +++ b/tests/roots/test-linkcheck-anchors-ignore/conf.py @@ -0,0 +1,3 @@ +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-anchors-ignore/index.rst b/tests/roots/test-linkcheck-anchors-ignore/index.rst new file mode 100644 index 0000000..22a1379 --- /dev/null +++ b/tests/roots/test-linkcheck-anchors-ignore/index.rst @@ -0,0 +1,2 @@ +* `Example Bar invalid `_ +* `Example Bar invalid `_ diff --git a/tests/roots/test-linkcheck-documents_exclude/br0ken_link.rst b/tests/roots/test-linkcheck-documents_exclude/br0ken_link.rst new file mode 100644 index 0000000..bf421f0 --- /dev/null +++ b/tests/roots/test-linkcheck-documents_exclude/br0ken_link.rst @@ -0,0 +1,5 @@ +Broken link +=========== + +Some links are `broken `__ +but sometimes not worrying about some broken links is a valid strategy. diff --git a/tests/roots/test-linkcheck-documents_exclude/broken_link.rst b/tests/roots/test-linkcheck-documents_exclude/broken_link.rst new file mode 100644 index 0000000..86e3bb4 --- /dev/null +++ b/tests/roots/test-linkcheck-documents_exclude/broken_link.rst @@ -0,0 +1,5 @@ +Broken link +=========== + +Some links are `broken `__ +but sometimes not worrying about some broken links is a valid strategy. diff --git a/tests/roots/test-linkcheck-documents_exclude/conf.py b/tests/roots/test-linkcheck-documents_exclude/conf.py new file mode 100644 index 0000000..52388f9 --- /dev/null +++ b/tests/roots/test-linkcheck-documents_exclude/conf.py @@ -0,0 +1,6 @@ +exclude_patterns = ['_build'] +linkcheck_exclude_documents = [ + '^broken_link$', + 'br[0-9]ken_link', +] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-documents_exclude/index.rst b/tests/roots/test-linkcheck-documents_exclude/index.rst new file mode 100644 index 0000000..57c39d8 --- /dev/null +++ b/tests/roots/test-linkcheck-documents_exclude/index.rst @@ -0,0 +1,3 @@ +.. toctree:: + broken_link + br0ken_link \ No newline at end of file diff --git a/tests/roots/test-linkcheck-localserver-anchor/conf.py b/tests/roots/test-linkcheck-localserver-anchor/conf.py new file mode 100644 index 0000000..0005bfa --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-anchor/conf.py @@ -0,0 +1,3 @@ +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-localserver-anchor/index.rst b/tests/roots/test-linkcheck-localserver-anchor/index.rst new file mode 100644 index 0000000..807fe96 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-anchor/index.rst @@ -0,0 +1 @@ +`local server `_ diff --git a/tests/roots/test-linkcheck-localserver-https/conf.py b/tests/roots/test-linkcheck-localserver-https/conf.py new file mode 100644 index 0000000..a2ce01e --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-https/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-localserver-https/index.rst b/tests/roots/test-linkcheck-localserver-https/index.rst new file mode 100644 index 0000000..fea5983 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-https/index.rst @@ -0,0 +1 @@ +`HTTPS server `_ diff --git a/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py b/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py new file mode 100644 index 0000000..a2ce01e --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-warn-redirects/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-localserver-warn-redirects/index.rst b/tests/roots/test-linkcheck-localserver-warn-redirects/index.rst new file mode 100644 index 0000000..7359bd5 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver-warn-redirects/index.rst @@ -0,0 +1,3 @@ +`local server1 `_ + +`local server2 `_ diff --git a/tests/roots/test-linkcheck-localserver/conf.py b/tests/roots/test-linkcheck-localserver/conf.py new file mode 100644 index 0000000..a2ce01e --- /dev/null +++ b/tests/roots/test-linkcheck-localserver/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-localserver/index.rst b/tests/roots/test-linkcheck-localserver/index.rst new file mode 100644 index 0000000..c617e94 --- /dev/null +++ b/tests/roots/test-linkcheck-localserver/index.rst @@ -0,0 +1 @@ +`local server `_ diff --git a/tests/roots/test-linkcheck-raw-node/conf.py b/tests/roots/test-linkcheck-raw-node/conf.py new file mode 100644 index 0000000..a2ce01e --- /dev/null +++ b/tests/roots/test-linkcheck-raw-node/conf.py @@ -0,0 +1,2 @@ +exclude_patterns = ['_build'] +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-raw-node/index.rst b/tests/roots/test-linkcheck-raw-node/index.rst new file mode 100644 index 0000000..76e26b5 --- /dev/null +++ b/tests/roots/test-linkcheck-raw-node/index.rst @@ -0,0 +1,2 @@ +.. raw:: html + :url: http://localhost:7777/ diff --git a/tests/roots/test-linkcheck-too-many-retries/conf.py b/tests/roots/test-linkcheck-too-many-retries/conf.py new file mode 100644 index 0000000..0005bfa --- /dev/null +++ b/tests/roots/test-linkcheck-too-many-retries/conf.py @@ -0,0 +1,3 @@ +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck-too-many-retries/index.rst b/tests/roots/test-linkcheck-too-many-retries/index.rst new file mode 100644 index 0000000..29b1ae4 --- /dev/null +++ b/tests/roots/test-linkcheck-too-many-retries/index.rst @@ -0,0 +1 @@ +`Non-existing uri with localhost `_ diff --git a/tests/roots/test-linkcheck/conf.py b/tests/roots/test-linkcheck/conf.py new file mode 100644 index 0000000..6ddb41a --- /dev/null +++ b/tests/roots/test-linkcheck/conf.py @@ -0,0 +1,4 @@ +root_doc = 'links' +exclude_patterns = ['_build'] +linkcheck_anchors = True +linkcheck_timeout = 0.05 diff --git a/tests/roots/test-linkcheck/links.rst b/tests/roots/test-linkcheck/links.rst new file mode 100644 index 0000000..88c757e --- /dev/null +++ b/tests/roots/test-linkcheck/links.rst @@ -0,0 +1,14 @@ +Some additional anchors to exercise ignore code + +* `Valid url `_ +* `Bar anchor invalid (trailing slash) `_ +* `Bar anchor invalid `_ tests that default ignore anchor of #! does not need to be prefixed with / +* `Top anchor invalid `_ +* `'does-not-exist' anchor invalid `_ +* `Valid local file `_ +* `Invalid local file `_ + +.. image:: http://localhost:7777/image.png +.. figure:: http://localhost:7777/image2.png + +* `Valid anchored url `_ diff --git a/tests/roots/test-local-logo/conf.py b/tests/roots/test-local-logo/conf.py new file mode 100644 index 0000000..1a166c1 --- /dev/null +++ b/tests/roots/test-local-logo/conf.py @@ -0,0 +1,4 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] +html_logo = "images/img.png" diff --git a/tests/roots/test-local-logo/images/img.png b/tests/roots/test-local-logo/images/img.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-local-logo/images/img.png differ diff --git a/tests/roots/test-local-logo/index.rst b/tests/roots/test-local-logo/index.rst new file mode 100644 index 0000000..af12ed6 --- /dev/null +++ b/tests/roots/test-local-logo/index.rst @@ -0,0 +1,31 @@ +The basic Sphinx documentation for testing +========================================== + +Sphinx is a tool that makes it easy to create intelligent and beautiful +documentation for Python projects (or other documents consisting of multiple +reStructuredText sources), written by Georg Brandl. It was originally created +for the new Python documentation, and has excellent facilities for Python +project documentation, but C/C++ is supported as well, and more languages are +planned. + +Sphinx uses reStructuredText as its markup language, and many of its strengths +come from the power and straightforwardness of reStructuredText and its parsing +and translating suite, the Docutils. + +features +-------- + +Among its features are the following: + +* Output formats: HTML (including derivative formats such as HTML Help, Epub + and Qt Help), plain text, manual pages and LaTeX or direct PDF output + using rst2pdf +* Extensive cross-references: semantic markup and automatic links + for functions, classes, glossary terms and similar pieces of information +* Hierarchical structure: easy definition of a document tree, with automatic + links to siblings, parents and children +* Automatic indices: general index as well as a module index +* Code handling: automatic highlighting using the Pygments highlighter +* Flexible HTML output using the Jinja 2 templating engine +* Various extensions are available, e.g. for automatic testing of snippets + and inclusion of appropriately formatted docstrings diff --git a/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.mo b/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.mo new file mode 100644 index 0000000..6aa00f7 Binary files /dev/null and b/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.mo differ diff --git a/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.po b/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.po new file mode 100644 index 0000000..ee1f6c2 --- /dev/null +++ b/tests/roots/test-locale/locale1/en/LC_MESSAGES/myext.po @@ -0,0 +1,2 @@ +msgid "Hello world" +msgstr "HELLO WORLD" diff --git a/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.mo b/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.mo new file mode 100644 index 0000000..c99a368 Binary files /dev/null and b/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.mo differ diff --git a/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.po b/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.po new file mode 100644 index 0000000..1ecf6e3 --- /dev/null +++ b/tests/roots/test-locale/locale1/et/LC_MESSAGES/myext.po @@ -0,0 +1,2 @@ +msgid "Hello world" +msgstr "Tere maailm" diff --git a/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.mo b/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.mo new file mode 100644 index 0000000..14c34d0 Binary files /dev/null and b/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.mo differ diff --git a/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.po b/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.po new file mode 100644 index 0000000..d376cf9 --- /dev/null +++ b/tests/roots/test-locale/locale2/en/LC_MESSAGES/myext.po @@ -0,0 +1,2 @@ +msgid "Hello sphinx" +msgstr "HELLO SPHINX" diff --git a/tests/roots/test-manpage_url/conf.py b/tests/roots/test-manpage_url/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-manpage_url/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-manpage_url/index.rst b/tests/roots/test-manpage_url/index.rst new file mode 100644 index 0000000..50d3b04 --- /dev/null +++ b/tests/roots/test-manpage_url/index.rst @@ -0,0 +1,3 @@ + * :manpage:`man(1)` + * :manpage:`ls.1` + * :manpage:`sphinx` diff --git a/tests/roots/test-markup-citation/conf.py b/tests/roots/test-markup-citation/conf.py new file mode 100644 index 0000000..e274bde --- /dev/null +++ b/tests/roots/test-markup-citation/conf.py @@ -0,0 +1,3 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-markup-citation/index.rst b/tests/roots/test-markup-citation/index.rst new file mode 100644 index 0000000..238f093 --- /dev/null +++ b/tests/roots/test-markup-citation/index.rst @@ -0,0 +1,9 @@ +test-markup-citation +===================== + +This is a citation ref; [CITE1]_ and [CITE2]_. + +.. [CITE1] This is a citation + +.. [CITE2] This is + a multiline citation diff --git a/tests/roots/test-markup-rubric/conf.py b/tests/roots/test-markup-rubric/conf.py new file mode 100644 index 0000000..e274bde --- /dev/null +++ b/tests/roots/test-markup-rubric/conf.py @@ -0,0 +1,3 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-markup-rubric/index.rst b/tests/roots/test-markup-rubric/index.rst new file mode 100644 index 0000000..c2ae68a --- /dev/null +++ b/tests/roots/test-markup-rubric/index.rst @@ -0,0 +1,7 @@ +test-markup-rubric +=================== + +.. rubric:: This is a rubric + +.. rubric:: This is + a multiline rubric diff --git a/tests/roots/test-maxlistdepth/conf.py b/tests/roots/test-maxlistdepth/conf.py new file mode 100644 index 0000000..a3b12a2 --- /dev/null +++ b/tests/roots/test-maxlistdepth/conf.py @@ -0,0 +1,5 @@ +exclude_patterns = ['_build'] + +latex_elements = { + 'maxlistdepth': '10', +} diff --git a/tests/roots/test-maxlistdepth/index.rst b/tests/roots/test-maxlistdepth/index.rst new file mode 100644 index 0000000..5d9bc21 --- /dev/null +++ b/tests/roots/test-maxlistdepth/index.rst @@ -0,0 +1,57 @@ +test-maxlistdepth +================= + + +1. 1 + + 1. 2 + + 1. 3 + + 1. 4 + + 1. 5 + + 1. 6 + + 1. 7 + + 1. 8 + + 1. 9 + + 10a + + - 10b + + .. code-block:: python + + def foo(): + + +- 1 + + - 2 + + - 3 + + - 4 + + - 5 + + - 6 + + - 7 + + - 8 + + 1. 9 + + 10a + + 1. 10b + + .. code-block:: python + + def foo(): + diff --git a/tests/roots/test-metadata/conf.py b/tests/roots/test-metadata/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-metadata/index.rst b/tests/roots/test-metadata/index.rst new file mode 100644 index 0000000..42af665 --- /dev/null +++ b/tests/roots/test-metadata/index.rst @@ -0,0 +1,46 @@ +:Author: David Goodger +:Address: 123 Example Street + Example, EX Canada + A1B 2C3 +:Contact: goodger@python.org +:Authors: Me; Myself; I +:organization: humankind +:date: $Date: 2006-05-21 22:44:42 +0200 (Son, 21 Mai 2006) $ +:status: This is a "work in progress" +:revision: $Revision: 4564 $ +:version: 1 +:copyright: This document has been placed in the public domain. You + may do with it as you wish. You may copy, modify, + redistribute, reattribute, sell, buy, rent, lease, + destroy, or improve it, quote it at length, excerpt, + incorporate, collate, fold, staple, or mutilate it, or do + anything else to it that your or anyone else's heart + desires. +:field name: This is a generic bibliographic field. +:field name 2: + Generic bibliographic fields may contain multiple body elements. + + Like this. + +:Dedication: + + For Docutils users & co-developers. + +:abstract: + + This document is a demonstration of the reStructuredText markup + language, containing examples of all basic reStructuredText + constructs and many advanced constructs. + +:nocomments: +:orphan: +:tocdepth: 1 + +.. meta:: + :keywords: reStructuredText, demonstration, demo, parser + :description lang=en: A demonstration of the reStructuredText + markup language, containing examples of all basic + constructs and many advanced constructs. + +test-metadata +============== diff --git a/tests/roots/test-need-escaped/bar.rst b/tests/roots/test-need-escaped/bar.rst new file mode 100644 index 0000000..1cccd3c --- /dev/null +++ b/tests/roots/test-need-escaped/bar.rst @@ -0,0 +1,2 @@ +bar +=== diff --git a/tests/roots/test-need-escaped/baz.rst b/tests/roots/test-need-escaped/baz.rst new file mode 100644 index 0000000..52e2e72 --- /dev/null +++ b/tests/roots/test-need-escaped/baz.rst @@ -0,0 +1,2 @@ +baz +=== diff --git a/tests/roots/test-need-escaped/conf.py b/tests/roots/test-need-escaped/conf.py new file mode 100644 index 0000000..0461ea3 --- /dev/null +++ b/tests/roots/test-need-escaped/conf.py @@ -0,0 +1,2 @@ +project = 'need "escaped" project' +smartquotes = False diff --git a/tests/roots/test-need-escaped/foo.rst b/tests/roots/test-need-escaped/foo.rst new file mode 100644 index 0000000..70859b3 --- /dev/null +++ b/tests/roots/test-need-escaped/foo.rst @@ -0,0 +1,15 @@ + +===== + +.. toctree:: + + quux + +foo "1" +------- + +foo.1-1 +^^^^^^^ + +foo.2 +----- diff --git a/tests/roots/test-need-escaped/index.rst b/tests/roots/test-need-escaped/index.rst new file mode 100644 index 0000000..9ef74e0 --- /dev/null +++ b/tests/roots/test-need-escaped/index.rst @@ -0,0 +1,30 @@ +.. Sphinx Tests documentation master file, created by sphinx-quickstart on Wed Jun 4 23:49:58 2008. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Sphinx Tests's documentation! +======================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + :name: mastertoc + + foo + bar + http://sphinx-doc.org/ + baz + qux + +.. index:: + pair: "subsection"; + +---------- +subsection +---------- + +subsubsection +------------- diff --git a/tests/roots/test-need-escaped/quux.rst b/tests/roots/test-need-escaped/quux.rst new file mode 100644 index 0000000..07dd0a0 --- /dev/null +++ b/tests/roots/test-need-escaped/quux.rst @@ -0,0 +1,2 @@ +quux +==== diff --git a/tests/roots/test-need-escaped/qux.rst b/tests/roots/test-need-escaped/qux.rst new file mode 100644 index 0000000..26176b9 --- /dev/null +++ b/tests/roots/test-need-escaped/qux.rst @@ -0,0 +1 @@ +qux.rst has no section title diff --git a/tests/roots/test-nested-enumerated-list/conf.py b/tests/roots/test-nested-enumerated-list/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-nested-enumerated-list/index.rst b/tests/roots/test-nested-enumerated-list/index.rst new file mode 100644 index 0000000..28ad72f --- /dev/null +++ b/tests/roots/test-nested-enumerated-list/index.rst @@ -0,0 +1,21 @@ +nested-enumerated-list +====================== + +5. Sphinx + + d. Documentation builder + e. Egypt + + 10) Pyramid + 11) Nile River + + (x) Atbara + (y) Blue Nile + (#) Sobat + (#) Semliki + (#) Kagera + +6. Markup + + iii. reStructuredText + iv. Markdown diff --git a/tests/roots/test-nested-tables/conf.py b/tests/roots/test-nested-tables/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-nested-tables/index.rst b/tests/roots/test-nested-tables/index.rst new file mode 100644 index 0000000..79110ae --- /dev/null +++ b/tests/roots/test-nested-tables/index.rst @@ -0,0 +1,16 @@ +nested-tables +============= + +.. list-table:: + :header-rows: 1 + + * - heading + - heading + * - content + - .. list-table:: + :header-rows: 1 + + * - heading + - heading + * - content + - content diff --git a/tests/roots/test-nitpicky-warnings/conf.py b/tests/roots/test-nitpicky-warnings/conf.py new file mode 100644 index 0000000..2db221c --- /dev/null +++ b/tests/roots/test-nitpicky-warnings/conf.py @@ -0,0 +1 @@ +nitpicky = True diff --git a/tests/roots/test-nitpicky-warnings/index.rst b/tests/roots/test-nitpicky-warnings/index.rst new file mode 100644 index 0000000..e73840d --- /dev/null +++ b/tests/roots/test-nitpicky-warnings/index.rst @@ -0,0 +1,7 @@ +test-nitpicky-warnings +====================== + +:py:const:`prefix.anything.postfix` +:py:class:`prefix.anything` +:py:class:`anything.postfix` +:js:class:`prefix.anything.postfix` diff --git a/tests/roots/test-numbered-circular/conf.py b/tests/roots/test-numbered-circular/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-numbered-circular/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-numbered-circular/index.rst b/tests/roots/test-numbered-circular/index.rst new file mode 100644 index 0000000..c3129cd --- /dev/null +++ b/tests/roots/test-numbered-circular/index.rst @@ -0,0 +1,5 @@ +.. toctree:: + :numbered: + + sub + diff --git a/tests/roots/test-numbered-circular/sub.rst b/tests/roots/test-numbered-circular/sub.rst new file mode 100644 index 0000000..cebfd65 --- /dev/null +++ b/tests/roots/test-numbered-circular/sub.rst @@ -0,0 +1,3 @@ +.. toctree:: + + index diff --git a/tests/roots/test-numfig/bar.rst b/tests/roots/test-numfig/bar.rst new file mode 100644 index 0000000..c4367c5 --- /dev/null +++ b/tests/roots/test-numfig/bar.rst @@ -0,0 +1,66 @@ +.. _bar: + +=== +Bar +=== + +.. _bar_a: + +Bar A +===== + +.. figure:: rimg.png + + should be Fig.2.1 + +.. csv-table:: should be Table 2.1 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 2.1 + + print('hello world') + +.. toctree:: + + baz + +.. figure:: rimg.png + + should be Fig.2.3 + +.. csv-table:: should be Table 2.3 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 2.3 + + print('hello world') + +.. _bar_b: + +Bar B +===== + +.. _bar_b1: + +Bar B1 +------ + +.. figure:: rimg.png + + should be Fig.2.4 + +.. csv-table:: should be Table 2.4 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 2.4 + + print('hello world') diff --git a/tests/roots/test-numfig/baz.rst b/tests/roots/test-numfig/baz.rst new file mode 100644 index 0000000..3ac684b --- /dev/null +++ b/tests/roots/test-numfig/baz.rst @@ -0,0 +1,24 @@ +.. _baz_a: + +Baz A +----- + +.. _fig22: + +.. figure:: rimg.png + + should be Fig.2.2 + +.. _table22: + +.. csv-table:: should be Table 2.2 + :header-rows: 0 + + hello,world + +.. _CODE22: + +.. code-block:: python + :caption: should be List 2.2 + + print('hello world') diff --git a/tests/roots/test-numfig/conf.py b/tests/roots/test-numfig/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-numfig/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-numfig/foo.rst b/tests/roots/test-numfig/foo.rst new file mode 100644 index 0000000..6b6a865 --- /dev/null +++ b/tests/roots/test-numfig/foo.rst @@ -0,0 +1,81 @@ +.. _foo: + +=== +Foo +=== + +.. figure:: rimg.png + + should be Fig.1.1 + +.. csv-table:: should be Table 1.1 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 1.1 + + print('hello world') + +.. _foo_a: + +Foo A +===== + +.. figure:: rimg.png + + should be Fig.1.2 + +.. figure:: rimg.png + + should be Fig.1.3 + +.. csv-table:: should be Table 1.2 + :header-rows: 0 + + hello,world + +.. csv-table:: should be Table 1.3 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 1.2 + + print('hello world') + +.. code-block:: python + :caption: should be List 1.3 + + print('hello world') + +.. _foo_a1: + +Foo A1 +------ + +.. _foo_b: + +Foo B +===== + +.. _foo_b1: + +Foo B1 +------ + +.. figure:: rimg.png + + should be Fig.1.4 + +.. csv-table:: should be Table 1.4 + :header-rows: 0 + + hello,world + +.. code-block:: python + :caption: should be List 1.4 + + print('hello world') diff --git a/tests/roots/test-numfig/index.rst b/tests/roots/test-numfig/index.rst new file mode 100644 index 0000000..9399038 --- /dev/null +++ b/tests/roots/test-numfig/index.rst @@ -0,0 +1,59 @@ +.. _index: + +test-tocdepth +============= + +.. toctree:: + :numbered: + + foo + bar + +.. _fig1: + +.. figure:: rimg.png + + should be Fig.1 + +.. figure:: rimg.png + + should be Fig.2 + +.. _table-1: + +.. csv-table:: should be Table 1 + :header-rows: 0 + + hello,world + +.. csv-table:: should be Table 2 + :header-rows: 0 + + hello,world + +.. _CODE_1: + +.. code-block:: python + :caption: should be List 1 + + print('hello world') + +.. code-block:: python + :caption: should be List 2 + + print('hello world') + + +* Fig.1 is :numref:`fig1` +* Fig.2.2 is :numref:`Figure%s ` +* Table.1 is :numref:`table-1` +* Table.2.2 is :numref:`Table:%s ` +* List.1 is :numref:`CODE_1` +* List.2.2 is :numref:`Code-%s ` +* Section.1 is :numref:`foo` +* Section.2.1 is :numref:`bar_a` +* Unnumbered section is :numref:`index` +* Invalid numfig_format 01: :numref:`invalid ` +* Invalid numfig_format 02: :numref:`Fig %s %s ` +* Fig.1 is :numref:`Fig.{number} {name} ` +* Section.1 is :numref:`Sect.{number} {name} ` diff --git a/tests/roots/test-numfig/rimg.png b/tests/roots/test-numfig/rimg.png new file mode 100644 index 0000000..fda6cd2 Binary files /dev/null and b/tests/roots/test-numfig/rimg.png differ diff --git a/tests/roots/test-object-description-sections/conf.py b/tests/roots/test-object-description-sections/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-object-description-sections/index.rst b/tests/roots/test-object-description-sections/index.rst new file mode 100644 index 0000000..1892f94 --- /dev/null +++ b/tests/roots/test-object-description-sections/index.rst @@ -0,0 +1,6 @@ +.. py:function:: func() + + Overview + -------- + + Lorem ipsum dolar sit amet diff --git a/tests/roots/test-productionlist/Bare.rst b/tests/roots/test-productionlist/Bare.rst new file mode 100644 index 0000000..8ea9213 --- /dev/null +++ b/tests/roots/test-productionlist/Bare.rst @@ -0,0 +1,6 @@ +Bare +==== + +.. productionlist:: + A: `A` | somethingA + B: `B` | somethingB diff --git a/tests/roots/test-productionlist/Dup1.rst b/tests/roots/test-productionlist/Dup1.rst new file mode 100644 index 0000000..5cd09cb --- /dev/null +++ b/tests/roots/test-productionlist/Dup1.rst @@ -0,0 +1,5 @@ +Dup1 +==== + +.. productionlist:: + Dup: `Dup` | somethingDup diff --git a/tests/roots/test-productionlist/Dup2.rst b/tests/roots/test-productionlist/Dup2.rst new file mode 100644 index 0000000..1d66375 --- /dev/null +++ b/tests/roots/test-productionlist/Dup2.rst @@ -0,0 +1,5 @@ +Dup2 +==== + +.. productionlist:: + Dup: `Dup` | somethingDup diff --git a/tests/roots/test-productionlist/LineContinuation.rst b/tests/roots/test-productionlist/LineContinuation.rst new file mode 100644 index 0000000..4943e8b --- /dev/null +++ b/tests/roots/test-productionlist/LineContinuation.rst @@ -0,0 +1,6 @@ +LineContinuation +================ + +.. productionlist:: lineContinuation + A: B C D \ + E F G diff --git a/tests/roots/test-productionlist/P1.rst b/tests/roots/test-productionlist/P1.rst new file mode 100644 index 0000000..6f9a863 --- /dev/null +++ b/tests/roots/test-productionlist/P1.rst @@ -0,0 +1,6 @@ +P1 +== + +.. productionlist:: P1 + A: `A` | somethingA + B: `B` | somethingB diff --git a/tests/roots/test-productionlist/P2.rst b/tests/roots/test-productionlist/P2.rst new file mode 100644 index 0000000..e6c3bc1 --- /dev/null +++ b/tests/roots/test-productionlist/P2.rst @@ -0,0 +1,6 @@ +P2 +== + +.. productionlist:: P2 + A: `A` | somethingA + B: `B` | somethingB diff --git a/tests/roots/test-productionlist/conf.py b/tests/roots/test-productionlist/conf.py new file mode 100644 index 0000000..a45d22e --- /dev/null +++ b/tests/roots/test-productionlist/conf.py @@ -0,0 +1 @@ +exclude_patterns = ['_build'] diff --git a/tests/roots/test-productionlist/firstLineRule.rst b/tests/roots/test-productionlist/firstLineRule.rst new file mode 100644 index 0000000..30ea6e0 --- /dev/null +++ b/tests/roots/test-productionlist/firstLineRule.rst @@ -0,0 +1,5 @@ +FirstLineRule +============= + +.. productionlist:: FirstLine: something + SecondLine: somethingElse diff --git a/tests/roots/test-productionlist/index.rst b/tests/roots/test-productionlist/index.rst new file mode 100644 index 0000000..4a0b978 --- /dev/null +++ b/tests/roots/test-productionlist/index.rst @@ -0,0 +1,27 @@ +.. toctree:: + + P1 + P2 + Bare + Dup1 + Dup2 + firstLineRule + LineContinuation + +- A: :token:`A` +- B: :token:`B` +- P1:A: :token:`P1:A` +- P1:B: :token:`P1:B` +- P2:A: :token:`P1:A` +- P2:B: :token:`P2:B` +- Explicit title A, plain: :token:`MyTitle ` +- Explicit title A, colon: :token:`My:Title ` +- Explicit title P1:A, plain: :token:`MyTitle ` +- Explicit title P1:A, colon: :token:`My:Title ` +- Tilde A: :token:`~A`. +- Tilde P1:A: :token:`~P1:A`. +- Tilde explicit title P1:A: :token:`~MyTitle ` +- Tilde, explicit title P1:A: :token:`MyTitle <~P1:A>` +- Dup: :token:`Dup` +- FirstLine: :token:`FirstLine` +- SecondLine: :token:`SecondLine` diff --git a/tests/roots/test-prolog/conf.py b/tests/roots/test-prolog/conf.py new file mode 100644 index 0000000..f6be09c --- /dev/null +++ b/tests/roots/test-prolog/conf.py @@ -0,0 +1,10 @@ +import os +import sys + +sys.path.insert(0, os.path.abspath('.')) + + +extensions = ['prolog_markdown_parser'] + +rst_prolog = '*Hello world*.\n\n' +rst_epilog = '\n\n*Good-bye world*.' diff --git a/tests/roots/test-prolog/index.rst b/tests/roots/test-prolog/index.rst new file mode 100644 index 0000000..2178d73 --- /dev/null +++ b/tests/roots/test-prolog/index.rst @@ -0,0 +1,7 @@ +prolog and epilog +================= + +.. toctree:: + + restructuredtext + markdown diff --git a/tests/roots/test-prolog/markdown.md b/tests/roots/test-prolog/markdown.md new file mode 100644 index 0000000..e400720 --- /dev/null +++ b/tests/roots/test-prolog/markdown.md @@ -0,0 +1,3 @@ +# sample document + +This is a sample document in markdown diff --git a/tests/roots/test-prolog/prolog_markdown_parser.py b/tests/roots/test-prolog/prolog_markdown_parser.py new file mode 100644 index 0000000..f8d787c --- /dev/null +++ b/tests/roots/test-prolog/prolog_markdown_parser.py @@ -0,0 +1,13 @@ +from docutils.parsers import Parser + + +class DummyMarkdownParser(Parser): + supported = ('markdown',) + + def parse(self, inputstring, document): + document.rawsource = inputstring + + +def setup(app): + app.add_source_suffix('.md', 'markdown') + app.add_source_parser(DummyMarkdownParser) diff --git a/tests/roots/test-prolog/restructuredtext.rst b/tests/roots/test-prolog/restructuredtext.rst new file mode 100644 index 0000000..f1fafb6 --- /dev/null +++ b/tests/roots/test-prolog/restructuredtext.rst @@ -0,0 +1,4 @@ +sample document +=============== + +This is a sample document in reST diff --git a/tests/roots/test-pycode/cp_1251_coded.py b/tests/roots/test-pycode/cp_1251_coded.py new file mode 100644 index 0000000..43d98f3 --- /dev/null +++ b/tests/roots/test-pycode/cp_1251_coded.py @@ -0,0 +1,4 @@ +#!python +# -*- coding: windows-1251 -*- + +X="" #:It MUST look like X="" \ No newline at end of file diff --git a/tests/roots/test-reST-code-block/conf.py b/tests/roots/test-reST-code-block/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-reST-code-block/index.rst b/tests/roots/test-reST-code-block/index.rst new file mode 100644 index 0000000..a7c7df0 --- /dev/null +++ b/tests/roots/test-reST-code-block/index.rst @@ -0,0 +1,7 @@ +.. code-block:: + :linenos: + + def hello(name) + print("hello", name) + + hello("Sphinx") diff --git a/tests/roots/test-reST-code-role/conf.py b/tests/roots/test-reST-code-role/conf.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-reST-code-role/index.rst b/tests/roots/test-reST-code-role/index.rst new file mode 100644 index 0000000..5be6bfc --- /dev/null +++ b/tests/roots/test-reST-code-role/index.rst @@ -0,0 +1,9 @@ +.. role:: python(code) + :language: python + :class: highlight + +Inline :python:`def foo(1 + 2 + None + "abc"): pass` code block + +.. code-block:: python + + def foo(1 + 2 + None + "abc"): pass diff --git a/tests/roots/test-refonly_bullet_list/conf.py b/tests/roots/test-refonly_bullet_list/conf.py new file mode 100644 index 0000000..bdccf9c --- /dev/null +++ b/tests/roots/test-refonly_bullet_list/conf.py @@ -0,0 +1 @@ +html_compact_lists = False diff --git a/tests/roots/test-refonly_bullet_list/index.rst b/tests/roots/test-refonly_bullet_list/index.rst new file mode 100644 index 0000000..9d8539d --- /dev/null +++ b/tests/roots/test-refonly_bullet_list/index.rst @@ -0,0 +1,14 @@ +test-refonly_bullet_list +======================== + +List A: + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + +List B: + +* Hello +* Sphinx +* World diff --git a/tests/roots/test-remote-logo/conf.py b/tests/roots/test-remote-logo/conf.py new file mode 100644 index 0000000..07949ba --- /dev/null +++ b/tests/roots/test-remote-logo/conf.py @@ -0,0 +1,5 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] +html_logo = "https://www.python.org/static/img/python-logo.png" +html_favicon = "https://www.python.org/static/favicon.ico" diff --git a/tests/roots/test-remote-logo/index.rst b/tests/roots/test-remote-logo/index.rst new file mode 100644 index 0000000..af12ed6 --- /dev/null +++ b/tests/roots/test-remote-logo/index.rst @@ -0,0 +1,31 @@ +The basic Sphinx documentation for testing +========================================== + +Sphinx is a tool that makes it easy to create intelligent and beautiful +documentation for Python projects (or other documents consisting of multiple +reStructuredText sources), written by Georg Brandl. It was originally created +for the new Python documentation, and has excellent facilities for Python +project documentation, but C/C++ is supported as well, and more languages are +planned. + +Sphinx uses reStructuredText as its markup language, and many of its strengths +come from the power and straightforwardness of reStructuredText and its parsing +and translating suite, the Docutils. + +features +-------- + +Among its features are the following: + +* Output formats: HTML (including derivative formats such as HTML Help, Epub + and Qt Help), plain text, manual pages and LaTeX or direct PDF output + using rst2pdf +* Extensive cross-references: semantic markup and automatic links + for functions, classes, glossary terms and similar pieces of information +* Hierarchical structure: easy definition of a document tree, with automatic + links to siblings, parents and children +* Automatic indices: general index as well as a module index +* Code handling: automatic highlighting using the Pygments highlighter +* Flexible HTML output using the Jinja 2 templating engine +* Various extensions are available, e.g. for automatic testing of snippets + and inclusion of appropriately formatted docstrings diff --git a/tests/roots/test-roles-download/another/dummy.dat b/tests/roots/test-roles-download/another/dummy.dat new file mode 100644 index 0000000..f6d9fed --- /dev/null +++ b/tests/roots/test-roles-download/another/dummy.dat @@ -0,0 +1 @@ +this one will have some content diff --git a/tests/roots/test-roles-download/conf.py b/tests/roots/test-roles-download/conf.py new file mode 100644 index 0000000..e274bde --- /dev/null +++ b/tests/roots/test-roles-download/conf.py @@ -0,0 +1,3 @@ +latex_documents = [ + ('index', 'test.tex', 'The basic Sphinx documentation for testing', 'Sphinx', 'report') +] diff --git a/tests/roots/test-roles-download/dummy.dat b/tests/roots/test-roles-download/dummy.dat new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-roles-download/index.rst b/tests/roots/test-roles-download/index.rst new file mode 100644 index 0000000..cdb075e --- /dev/null +++ b/tests/roots/test-roles-download/index.rst @@ -0,0 +1,7 @@ +test-roles-download +=================== + +* :download:`dummy.dat` +* :download:`another/dummy.dat` +* :download:`not_found.dat` +* :download:`Sphinx logo ` diff --git a/tests/roots/test-root/Makefile b/tests/roots/test-root/Makefile new file mode 100644 index 0000000..85a93bc --- /dev/null +++ b/tests/roots/test-root/Makefile @@ -0,0 +1,67 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build + +# Internal variables. +ALLSPHINXOPTS = -d _build/doctrees $(SPHINXOPTS) . + +.PHONY: help clean html web pickle htmlhelp latex changes linkcheck + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " pickle to make pickle files (usable by e.g. sphinx-web)" + @echo " htmlhelp to make HTML files and an HTML help project" + @echo " latex to make LaTeX files" + @echo " changes to make an overview over all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + +clean: + rm -rf _build/* + +html: + mkdir -p _build/html _build/doctrees + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html + @echo + @echo "Build finished. The HTML pages are in _build/html." + +pickle: + mkdir -p _build/pickle _build/doctrees + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) _build/pickle + @echo + @echo "Build finished; now you can process the pickle files or run" + @echo " sphinx-web _build/pickle" + @echo "to start the sphinx-web server." + +web: pickle + +htmlhelp: + mkdir -p _build/htmlhelp _build/doctrees + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in _build/htmlhelp." + +latex: + mkdir -p _build/latex _build/doctrees + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) _build/latex + @echo + @echo "Build finished; the LaTeX files are in _build/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +changes: + mkdir -p _build/changes _build/doctrees + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) _build/changes + @echo + @echo "The overview file is in _build/changes." + +linkcheck: + mkdir -p _build/linkcheck _build/doctrees + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) _build/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in _build/linkcheck/output.txt." diff --git a/tests/roots/test-root/_templates/contentssb.html b/tests/roots/test-root/_templates/contentssb.html new file mode 100644 index 0000000..d0c276a --- /dev/null +++ b/tests/roots/test-root/_templates/contentssb.html @@ -0,0 +1,2 @@ +{# sidebar only for contents document #} +

Contents sidebar

diff --git a/tests/roots/test-root/_templates/customsb.html b/tests/roots/test-root/_templates/customsb.html new file mode 100644 index 0000000..0cd6735 --- /dev/null +++ b/tests/roots/test-root/_templates/customsb.html @@ -0,0 +1,4 @@ +{# custom sidebar template #} +

Custom sidebar

+ +{{ toctree(titles_only=True, maxdepth=1) }} diff --git a/tests/roots/test-root/_templates/layout.html b/tests/roots/test-root/_templates/layout.html new file mode 100644 index 0000000..db685b0 --- /dev/null +++ b/tests/roots/test-root/_templates/layout.html @@ -0,0 +1,15 @@ +{% extends "!layout.html" %} + +{% block extrahead %} +{# html_context variable from conf.py #} + +{# html_context variable from confoverrides (as if given on cmdline) #} + +{{ super() }} +{% endblock %} + +{% block sidebartoc %} +{# display global TOC in addition to local TOC #} +{{ super() }} +{{ toctree(collapse=False, maxdepth=-1) }} +{% endblock %} diff --git a/tests/roots/test-root/autodoc.txt b/tests/roots/test-root/autodoc.txt new file mode 100644 index 0000000..959ab2d --- /dev/null +++ b/tests/roots/test-root/autodoc.txt @@ -0,0 +1,39 @@ +Autodoc tests +============= + +Just testing a few autodoc possibilities... + +.. automodule:: autodoc_target + :members: + +.. autofunction:: function + +.. autoclass:: Class + :inherited-members: + + Additional content. + +.. autoclass:: Outer + :members: Inner + +.. autoattribute:: Class.docattr + +.. autoexception:: CustomEx + :members: f + +.. autoclass:: CustomDict + :show-inheritance: + :members: + + +.. currentmodule:: autodoc_target + +.. autoclass:: InstAttCls + :members: + + All members (5 total) + +.. autoclass:: InstAttCls + :members: ca1, ia1 + + Specific members (2 total) diff --git a/tests/roots/test-root/autodoc_target.py b/tests/roots/test-root/autodoc_target.py new file mode 100644 index 0000000..59f6c74 --- /dev/null +++ b/tests/roots/test-root/autodoc_target.py @@ -0,0 +1,221 @@ +import enum +from io import StringIO + +__all__ = ['Class'] + +#: documentation for the integer +integer = 1 + + +def raises(exc, func, *args, **kwds): + """Raise AssertionError if ``func(*args, **kwds)`` does not raise *exc*.""" + pass + + +class CustomEx(Exception): + """My custom exception.""" + + def f(self): + """Exception method.""" + + +class CustomDataDescriptor: + """Descriptor class docstring.""" + + def __init__(self, doc): + self.__doc__ = doc + + def __get__(self, obj, type=None): + if obj is None: + return self + return 42 + + def meth(self): + """Function.""" + return "The Answer" + + +class CustomDataDescriptorMeta(type): + """Descriptor metaclass docstring.""" + + +class CustomDataDescriptor2(CustomDataDescriptor): + """Descriptor class with custom metaclass docstring.""" + __metaclass__ = CustomDataDescriptorMeta + + +def _funky_classmethod(name, b, c, d, docstring=None): + """Generates a classmethod for a class from a template by filling out + some arguments.""" + def template(cls, a, b, c, d=4, e=5, f=6): + return a, b, c, d, e, f + from functools import partial + function = partial(template, b=b, c=c, d=d) + function.__name__ = name + function.__doc__ = docstring + return classmethod(function) + + +class Base: + def inheritedmeth(self): + """Inherited function.""" + + +class Derived(Base): + def inheritedmeth(self): + # no docstring here + pass + + +class Class(Base): + """Class to document.""" + + descr = CustomDataDescriptor("Descriptor instance docstring.") + + def meth(self): + """Function.""" + + def undocmeth(self): + pass + + def skipmeth(self): + """Method that should be skipped.""" + + def excludemeth(self): + """Method that should be excluded.""" + + # should not be documented + skipattr = 'foo' + + #: should be documented -- süß + attr = 'bar' + + @property + def prop(self): + """Property.""" + + docattr = 'baz' + """should likewise be documented -- süß""" + + udocattr = 'quux' + """should be documented as well - süß""" + + # initialized to any class imported from another module + mdocattr = StringIO() + """should be documented as well - süß""" + + roger = _funky_classmethod("roger", 2, 3, 4) + + moore = _funky_classmethod("moore", 9, 8, 7, + docstring="moore(a, e, f) -> happiness") + + def __init__(self, arg): + self.inst_attr_inline = None #: an inline documented instance attr + #: a documented instance attribute + self.inst_attr_comment = None + self.inst_attr_string = None + """a documented instance attribute""" + self._private_inst_attr = None #: a private instance attribute + + def __special1__(self): + """documented special method""" + + def __special2__(self): + # undocumented special method + pass + + +class CustomDict(dict): + """Docstring.""" + + +def function(foo, *args, **kwds): + """ + Return spam. + """ + pass + + +class Outer: + """Foo""" + + class Inner: + """Foo""" + + def meth(self): + """Foo""" + + # should be documented as an alias + factory = dict + + +class DocstringSig: + def meth(self): + """meth(FOO, BAR=1) -> BAZ +First line of docstring + + rest of docstring + """ + + def meth2(self): + """First line, no signature + Second line followed by indentation:: + + indented line + """ + + @property + def prop1(self): + """DocstringSig.prop1(self) + First line of docstring + """ + return 123 + + @property + def prop2(self): + """First line of docstring + Second line of docstring + """ + return 456 + + +class StrRepr(str): + def __repr__(self): + return self + + +class AttCls: + a1 = StrRepr('hello\nworld') + a2 = None + + +class InstAttCls: + """Class with documented class and instance attributes.""" + + #: Doc comment for class attribute InstAttCls.ca1. + #: It can have multiple lines. + ca1 = 'a' + + ca2 = 'b' #: Doc comment for InstAttCls.ca2. One line only. + + ca3 = 'c' + """Docstring for class attribute InstAttCls.ca3.""" + + def __init__(self): + #: Doc comment for instance attribute InstAttCls.ia1 + self.ia1 = 'd' + + self.ia2 = 'e' + """Docstring for instance attribute InstAttCls.ia2.""" + + +class EnumCls(enum.Enum): + """ + this is enum class + """ + + #: doc for val1 + val1 = 12 + val2 = 23 #: doc for val2 + val3 = 34 + """doc for val3""" diff --git a/tests/roots/test-root/bom.txt b/tests/roots/test-root/bom.txt new file mode 100644 index 0000000..3fea824 --- /dev/null +++ b/tests/roots/test-root/bom.txt @@ -0,0 +1,5 @@ +File with UTF-8 BOM +=================== + +This file has a UTF-8 "BOM". + diff --git a/tests/roots/test-root/conf.py b/tests/roots/test-root/conf.py new file mode 100644 index 0000000..154d4d1 --- /dev/null +++ b/tests/roots/test-root/conf.py @@ -0,0 +1,148 @@ +import os +import sys + +from docutils import nodes +from docutils.parsers.rst import Directive + +from sphinx import addnodes + +sys.path.append(os.path.abspath('.')) + +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.extlinks'] + +jsmath_path = 'dummy.js' + +templates_path = ['_templates'] + +source_suffix = ['.txt', '.add', '.foo'] + +project = 'Sphinx ' +copyright = '1234-6789, copyright text credits' +# If this is changed, remember to update the versionchanges! +version = '0.6' +release = '0.6alpha1' +today_fmt = '%B %d, %Y' +exclude_patterns = ['_build', '**/excluded.*'] +keep_warnings = True +pygments_style = 'sphinx' +show_authors = True +numfig = True + +html_sidebars = {'**': ['localtoc.html', 'relations.html', 'sourcelink.html', + 'customsb.html', 'searchbox.html'], + 'index': ['contentssb.html', 'localtoc.html', 'globaltoc.html']} +html_last_updated_fmt = '%b %d, %Y' +html_context = {'hckey': 'hcval', 'hckey_co': 'wrong_hcval_co'} + +latex_additional_files = ['svgimg.svg'] +# some random pdf layout parameters to check they don't break build +latex_elements = { + 'sphinxsetup': """ + verbatimwithframe, + verbatimwrapslines, + verbatimforcewraps, + verbatimmaxoverfull=1, + verbatimmaxunderfull=5, + verbatimhintsturnover=true, + verbatimcontinuesalign=l, + VerbatimColor={RGB}{242,242,242}, + VerbatimBorderColor={RGB}{32,32,32}, + VerbatimHighlightColor={RGB}{200,200,200}, + pre_box-decoration-break=slice, + pre_border-top-left-radius=20pt, + pre_border-top-right-radius=0pt, + pre_border-bottom-right-radius=20pt, + pre_border-bottom-left-radius=0pt, + verbatimsep=1pt, + pre_padding=5pt,% alias to verbatimsep + pre_border-top-width=5pt, + pre_border-right-width=10pt, + pre_border-bottom-width=15pt, + pre_border-left-width=20pt, + pre_border-width=3pt,% overrides all previous four + verbatimborder=2pt,% alias to pre_border-width +% + shadowrule=1pt, + shadowsep=10pt, + shadowsize=10pt, + div.topic_border-width=2pt,% alias to shadowrule + div.topic_padding=6pt,% alias to shadowsep + div.topic_box-shadow=5pt,% overrides/alias shadowsize +% + noteBorderColor={RGB}{204,204,204}, + hintBorderColor={RGB}{204,204,204}, + importantBorderColor={RGB}{204,204,204}, + tipBorderColor={RGB}{204,204,204}, +% + noteborder=5pt, + hintborder=5pt, + importantborder=5pt, + tipborder=5pt, +% + warningborder=3pt, + cautionborder=3pt, + attentionborder=3pt, + errorborder=3pt, +% + dangerborder=3pt, + div.danger_border-width=10pt, + div.danger_background-TeXcolor={rgb}{0,1,0}, + div.danger_border-TeXcolor={rgb}{0,0,1}, + div.danger_box-shadow=20pt -20pt, + div.danger_box-shadow-TeXcolor={rgb}{0.5,0.5,0.5}, +% + warningBorderColor={RGB}{255,119,119}, + cautionBorderColor={RGB}{255,119,119}, + attentionBorderColor={RGB}{255,119,119}, + dangerBorderColor={RGB}{255,119,119}, + errorBorderColor={RGB}{255,119,119}, + warningBgColor={RGB}{255,238,238}, + cautionBgColor={RGB}{255,238,238}, + attentionBgColor={RGB}{255,238,238}, + dangerBgColor={RGB}{255,238,238}, + errorBgColor={RGB}{255,238,238}, +% + TableRowColorHeader={rgb}{0,1,0}, + TableRowColorOdd={rgb}{0.5,0,0}, + TableRowColorEven={rgb}{0.1,0.1,0.1}, +""", +} + +coverage_c_path = ['special/*.h'] +coverage_c_regexes = {'function': r'^PyAPI_FUNC\(.*\)\s+([^_][\w_]+)'} + +extlinks = {'issue': ('http://bugs.python.org/issue%s', 'issue %s'), + 'pyurl': ('http://python.org/%s', None)} + +# modify tags from conf.py +tags.add('confpytag') + + +# -- extension API +def userdesc_parse(env, sig, signode): + x, y = sig.split(':') + signode += addnodes.desc_name(x, x) + signode += addnodes.desc_parameterlist() + signode[-1] += addnodes.desc_parameter(y, y) + return x + + +class ClassDirective(Directive): + option_spec = {'opt': lambda x: x} + + def run(self): + return [nodes.strong(text='from class: %s' % self.options['opt'])] + + +def setup(app): + import parsermod + + app.add_directive('clsdir', ClassDirective) + app.add_object_type('userdesc', 'userdescrole', '%s (userdesc)', + userdesc_parse, objname='user desc') + app.add_js_file('file://moo.js') + app.add_source_suffix('.foo', 'foo') + app.add_source_parser(parsermod.Parser) diff --git a/tests/roots/test-root/extapi.txt b/tests/roots/test-root/extapi.txt new file mode 100644 index 0000000..56be6d8 --- /dev/null +++ b/tests/roots/test-root/extapi.txt @@ -0,0 +1,7 @@ +Extension API tests +=================== + +Testing directives: + +.. clsdir:: + :opt: Bar diff --git a/tests/roots/test-root/extensions.txt b/tests/roots/test-root/extensions.txt new file mode 100644 index 0000000..96b1f8e --- /dev/null +++ b/tests/roots/test-root/extensions.txt @@ -0,0 +1,28 @@ +Test for diverse extensions +=========================== + +extlinks +-------- + +Test diverse links: :issue:`1000` and :pyurl:`dev/`, also with +:issue:`explicit caption <1042>`. + + +todo +---- + +.. todo:: + + Test the todo extension. + +.. todo:: + + Test with |sub| (see #286). + +.. |sub| replace:: substitution references + + +list of all todos +^^^^^^^^^^^^^^^^^ + +.. todolist:: diff --git a/tests/roots/test-root/file_with_special_#_chars.xyz b/tests/roots/test-root/file_with_special_#_chars.xyz new file mode 100644 index 0000000..e69de29 diff --git a/tests/roots/test-root/footnote.txt b/tests/roots/test-root/footnote.txt new file mode 100644 index 0000000..49cceee --- /dev/null +++ b/tests/roots/test-root/footnote.txt @@ -0,0 +1,60 @@ +:tocdepth: 2 + +Testing footnote and citation +================================ +.. #1058 footnote-backlinks-do-not-work + +numbered footnote +-------------------- + +[1]_ + +auto-numbered footnote +------------------------------ + +[#]_ + +named footnote +-------------------- + +[#foo]_ + +citation +-------------------- + +[bar]_ +[baz_qux]_ + +footnotes in table +-------------------- + +.. list-table:: Table caption [#]_ + :header-rows: 1 + + * - name [#]_ + - description + * - VIDIOC_CROPCAP + - Information about VIDIOC_CROPCAP [#]_ + +footenotes +-------------------- + +.. rubric:: Footnotes + +.. [1] numbered + +.. [#] auto numbered + +.. [#foo] named + +.. rubric:: Citations + +.. [bar] cite + +.. [baz_qux] citation including underscore + +.. [#] footnote in table caption + +.. [#] footnote in table header + +.. [#] footnote in table not in header diff --git a/tests/roots/test-root/images.txt b/tests/roots/test-root/images.txt new file mode 100644 index 0000000..1dc591a --- /dev/null +++ b/tests/roots/test-root/images.txt @@ -0,0 +1,25 @@ +Sphinx image handling +===================== + +.. first, a simple test with direct filename +.. image:: img.png + +.. an image with path name (relative to this directory!) +.. image:: subdir/img.png + :height: 100 + :width: 200 + +.. an image with unspecified extension +.. image:: img.* + +.. a non-local image URI +.. image:: https://www.python.org/static/img/python-logo.png + +.. an image with subdir and unspecified extension +.. image:: subdir/simg.* + +.. an SVG image (for HTML at least) +.. image:: svgimg.* + +.. an image with more than 1 dot in its file name +.. image:: img.foo.png diff --git a/tests/roots/test-root/img.foo.png b/tests/roots/test-root/img.foo.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-root/img.foo.png differ diff --git a/tests/roots/test-root/img.gif b/tests/roots/test-root/img.gif new file mode 100644 index 0000000..8f02686 Binary files /dev/null and b/tests/roots/test-root/img.gif differ diff --git a/tests/roots/test-root/img.pdf b/tests/roots/test-root/img.pdf new file mode 100644 index 0000000..cacbd85 Binary files /dev/null and b/tests/roots/test-root/img.pdf differ diff --git a/tests/roots/test-root/img.png b/tests/roots/test-root/img.png new file mode 100644 index 0000000..a97e86d Binary files /dev/null and b/tests/roots/test-root/img.png differ diff --git a/tests/roots/test-root/includes.txt b/tests/roots/test-root/includes.txt new file mode 100644 index 0000000..19b98ae --- /dev/null +++ b/tests/roots/test-root/includes.txt @@ -0,0 +1,102 @@ +Testing downloadable files +========================== + +Download :download:`img.png` here. +Download :download:`this ` there. +Download :download:`file with special characters `. + +Test file and literal inclusion +=============================== + +.. include:: subdir/include.inc + +.. include:: /subdir/include.inc + +.. literalinclude:: literal.inc + :language: python + +.. should succeed +.. literalinclude:: wrongenc.inc + :encoding: latin-1 + :language: none +.. include:: wrongenc.inc + :encoding: latin-1 + +Literalinclude options +====================== + +.. highlight:: text + +.. cssclass:: inc-pyobj1 +.. literalinclude:: literal.inc + :pyobject: Foo + +.. cssclass:: inc-pyobj2 +.. literalinclude:: literal.inc + :pyobject: Bar.baz + +.. cssclass:: inc-lines +.. literalinclude:: literal.inc + :lines: 6-7,9 + :lineno-start: 6 + +.. cssclass:: inc-startend +.. literalinclude:: literal.inc + :start-after: coding: utf-8 + :end-before: class Foo + +.. cssclass:: inc-preappend +.. literalinclude:: literal.inc + :prepend: START CODE + :append: END CODE + +.. literalinclude:: literal.inc + :start-after: utf-8 + +.. literalinclude:: literal.inc + :end-before: class Foo + +.. literalinclude:: literal.inc + :diff: literal_orig.inc + +.. cssclass:: inc-tab3 +.. literalinclude:: tabs.inc + :tab-width: 3 + :language: text + +.. cssclass:: inc-tab8 +.. literalinclude:: tabs.inc + :tab-width: 8 + :language: python + +.. cssclass:: inc-pyobj-lines-match +.. literalinclude:: literal.inc + :pyobject: Foo + :lineno-match: + +.. cssclass:: inc-lines-match +.. literalinclude:: literal.inc + :lines: 6-7,8 + :lineno-match: + +.. cssclass:: inc-startend-match +.. literalinclude:: literal.inc + :start-after: coding: utf-8 + :end-before: class Foo + :lineno-match: + +Test if dedenting before parsing works. + +.. highlight:: python + +.. cssclass:: inc-pyobj-dedent +.. literalinclude:: literal.inc + :pyobject: Bar.baz + +Docutils include with "literal" +=============================== + +While not recommended, it should work (and leave quotes alone). + +.. include:: quotes.inc + :literal: diff --git a/tests/roots/test-root/index.txt b/tests/roots/test-root/index.txt new file mode 100644 index 0000000..e39c958 --- /dev/null +++ b/tests/roots/test-root/index.txt @@ -0,0 +1,65 @@ +.. Sphinx Tests documentation master file, created by sphinx-quickstart on Wed Jun 4 23:49:58 2008. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Sphinx Tests's documentation! +======================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + :numbered: + :caption: Table of Contents + :name: mastertoc + + extapi + images + subdir/images + subdir/includes + includes + markup + objects + bom + math + autodoc + extensions + footnote + lists + otherext + + http://sphinx-doc.org/ + Latest reference + Python + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` + +References +========== + +.. [Ref1] Reference target. +.. [Ref_1] Reference target 2. + +Test for issue #1157 +==================== + +This used to crash: + +.. toctree:: + +.. toctree:: + :hidden: + +Test for issue #1700 +==================== + +:ref:`mastertoc` + +Test for indirect hyperlink targets +=================================== + +:ref:`indirect hyperref ` diff --git a/tests/roots/test-root/lists.txt b/tests/roots/test-root/lists.txt new file mode 100644 index 0000000..0b54454 --- /dev/null +++ b/tests/roots/test-root/lists.txt @@ -0,0 +1,70 @@ +Various kinds of lists +====================== + + +nested enumerated lists +----------------------- + +#. one + +#. two + + #. two.1 + #. two.2 + +#. three + + +enumerated lists with non-default start values +---------------------------------------------- + +0. zero +#. one + +---------------------------------------- + +1. one +#. two + +---------------------------------------- + +2. two +#. three + + +enumerated lists using letters +------------------------------ + +a. a + +b. b + +#. c + +#. d + +---------------------------------------- + +x. x + +y. y + +#. z + +#. { + +definition lists +----------------- + +term1 + description + +term2 (**stronged partially**) + description + +Samp tests +---------- + +:samp:`{variable_only}` +:samp:`{variable} and text` +:samp:`Show {variable} in the middle` diff --git a/tests/roots/test-root/literal.inc b/tests/roots/test-root/literal.inc new file mode 100644 index 0000000..694f15e --- /dev/null +++ b/tests/roots/test-root/literal.inc @@ -0,0 +1,13 @@ +# Literally included file using Python highlighting +# -*- coding: utf-8 -*- + +foo = "Including Unicode characters: üöä" + +class Foo: + pass + +class Bar: + def baz(): + pass + +def bar(): pass diff --git a/tests/roots/test-root/literal_orig.inc b/tests/roots/test-root/literal_orig.inc new file mode 100644 index 0000000..cfb5dd1 --- /dev/null +++ b/tests/roots/test-root/literal_orig.inc @@ -0,0 +1,12 @@ +# Literally included file using Python highlighting + +foo = "Including Unicode characters: üöä" # This will be changed + +class FooOrig: + pass + +class BarOrig: + def baz(): + pass + +def bar(): pass diff --git a/tests/roots/test-root/markup.txt b/tests/roots/test-root/markup.txt new file mode 100644 index 0000000..b59a652 --- /dev/null +++ b/tests/roots/test-root/markup.txt @@ -0,0 +1,455 @@ +:tocdepth: 2 + +.. title:: set by title directive +.. _1024: + +Testing various markup +====================== + +Meta markup +----------- + +.. sectionauthor:: Georg Brandl +.. moduleauthor:: Georg Brandl + +.. contents:: TOC + +.. meta:: + :author: Me + :keywords: docs, sphinx + + +Generic reST +------------ + +A |subst|! + +.. |subst| replace:: global substitution + +.. highlight:: none + +.. _label: + +:: + + some code + +Option list: + +-h help +--help also help + +Line block: + +| line1 +| line2 +| line3 +| line4 +| line5 +| line6 +| line7 + + +Body directives +^^^^^^^^^^^^^^^ + +.. topic:: Title + + Topic body. + +.. sidebar:: Sidebar + :subtitle: Sidebar subtitle + + Sidebar body. + +.. rubric:: Test rubric + +.. epigraph:: Epigraph title + + Epigraph body. + + -- Author + +.. highlights:: Highlights + + Highlights body. + +.. pull-quote:: Pull-quote + + Pull quote body. + +.. compound:: + + a + + b + +.. parsed-literal:: + + with some *markup* inside + + +.. _admonition-section: + +Admonitions +^^^^^^^^^^^ + +.. admonition:: My Admonition + + Admonition text. + +.. note:: + Note text. + +.. warning:: + + Warning text. + +.. _some-label: + +.. tip:: + Tip text. + +Indirect hyperlink targets + +.. _other-label: some-label_ + +Inline markup +------------- + +*Generic inline markup* + +Adding \n to test unescaping. + +* :command:`command\\n` +* :dfn:`dfn\\n` +* :guilabel:`guilabel with &accelerator and \\n` +* :kbd:`kbd\\n` +* :mailheader:`mailheader\\n` +* :makevar:`makevar\\n` +* :manpage:`manpage\\n` +* :mimetype:`mimetype\\n` +* :newsgroup:`newsgroup\\n` +* :program:`program\\n` +* :regexp:`regexp\\n` +* :menuselection:`File --> Close\\n` +* :menuselection:`&File --> &Print` +* :file:`a/{varpart}/b\\n` +* :samp:`print {i}\\n` + +*Linking inline markup* + +* :pep:`8` +* :pep:`Python Enhancement Proposal #8 <8>` +* :rfc:`1` +* :rfc:`Request for Comments #1 <1>` +* :envvar:`HOME` +* :keyword:`with` +* :token:`try statement ` +* :ref:`admonition-section` +* :ref:`here ` +* :ref:`there ` +* :ref:`my-figure` +* :ref:`my-figure-name` +* :ref:`my-table` +* :ref:`my-table-name` +* :ref:`my-code-block` +* :ref:`my-code-block-name` +* :ref:`1024` +* :numref:`my-figure` +* :numref:`my-figure-name` +* :numref:`my-table` +* :numref:`my-table-name` +* :numref:`my-code-block` +* :numref:`my-code-block-name` +* :doc:`subdir/includes` +* ``:download:`` is tested in includes.txt +* :option:`Python -c option ` + +Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`. + +Testing the :index:`index` role, also available with +:index:`explicit ` title. + +.. _with: + +With +---- + +(Empty section.) + + +Tables +------ + +.. tabularcolumns:: |L|p{5cm}|R| + +.. _my-table: + +.. table:: my table + :name: my-table-name + + +----+----------------+----+ + | 1 | * Block elems | x | + | | * In table | | + +----+----------------+----+ + | 2 | Empty cells: | | + +----+----------------+----+ + +.. table:: empty cell in table header + + ===== ====== + \ + ===== ====== + 1 2 + 3 4 + ===== ====== + +Tables with multirow and multicol: + +.. only:: latex + + +----+----------------+---------+ + | 1 | test! | c | + +----+---------+------+ | + | 2 | col | col | | + | y +---------+------+----+----+ + | x | multi-column cell | x | + +----+---------------------+----+ + + +----+ + | 1 | + + + + | | + +----+ + +.. list-table:: + :header-rows: 0 + + * - .. figure:: img.png + + figure in table + + +Figures +------- + +.. _my-figure: + +.. figure:: img.png + :name: my-figure-name + + My caption of the figure + + My description paragraph of the figure. + + Description paragraph is wrapped with legend node. + +.. figure:: rimg.png + :align: right + + figure with align option + +.. figure:: rimg.png + :align: right + :figwidth: 50% + + figure with align & figwidth option + +.. figure:: rimg.png + :align: right + :width: 3cm + + figure with align & width option + +Version markup +-------------- + +.. versionadded:: 0.6 + Some funny **stuff**. + +.. versionchanged:: 0.6 + Even more funny stuff. + +.. deprecated:: 0.6 + Boring stuff. + +.. versionadded:: 1.2 + + First paragraph of versionadded. + +.. versionchanged:: 1.2 + First paragraph of versionchanged. + + Second paragraph of versionchanged. + + +Code blocks +----------- + +.. _my-code-block: + +.. code-block:: ruby + :linenos: + :caption: my ruby code + :name: my-code-block-name + + def ruby? + false + end + +Misc stuff +---------- + +Stuff [#]_ + +Reference lookup: [Ref1]_ (defined in another file). +Reference lookup underscore: [Ref_1]_ + +.. seealso:: something, something else, something more + + `Google `_ + For everything. + +.. hlist:: + :columns: 4 + + * This + * is + * a horizontal + * list + * with several + * items + +.. rubric:: Side note + +This is a side note. + +This tests :CLASS:`role names in uppercase`. + +.. centered:: LICENSE AGREEMENT + +.. acks:: + + * Terry Pratchett + * J. R. R. Tolkien + * Monty Python + +.. glossary:: + :sorted: + + boson + Particle with integer spin. + + *fermion* + Particle with half-integer spin. + + tauon + myon + electron + Examples for fermions. + + über + Gewisse + + ähnlich + Dinge + +.. productionlist:: + try_stmt: `try1_stmt` | `try2_stmt` + try1_stmt: "try" ":" `suite` + : ("except" [`expression` ["," `target`]] ":" `suite`)+ + : ["else" ":" `suite`] + : ["finally" ":" `suite`] + try2_stmt: "try" ":" `suite` + : "finally" ":" `suite` + + +Index markup +------------ + +.. index:: + single: entry + pair: entry; pair + double: entry; double + triple: index; entry; triple + see: from; to + seealso: fromalso; toalso + +.. index:: + !Main, !Other + !single: entry; pair + +:index:`!Main` + +.. _ölabel: + +Ö... Some strange characters +---------------------------- + +Testing öäü... + + +Only directive +-------------- + +.. only:: html + + In HTML. + +.. only:: latex + + In LaTeX. + +.. only:: html or latex + + In both. + +.. only:: confpytag and (testtag or nonexisting_tag) + + Always present, because set through conf.py/command line. + + +Any role +-------- + +.. default-role:: any + +Test referencing to `headings ` and `objects `. +Also `modules ` and `classes
') + assert malloc_html in htmltext + + +@pytest.mark.sphinx( + 'changes', testroot='changes', srcdir='changes-none', + confoverrides={'version': '0.7', 'release': '0.7b1'}) +def test_no_changes(app, status): + app.build() + + assert 'no changes in version 0.7.' in status.getvalue() + assert not (app.outdir / 'changes.html').exists() diff --git a/tests/test_build_dirhtml.py b/tests/test_build_dirhtml.py new file mode 100644 index 0000000..dc5ab86 --- /dev/null +++ b/tests/test_build_dirhtml.py @@ -0,0 +1,40 @@ +"""Test dirhtml builder.""" + +import posixpath + +import pytest + +from sphinx.util.inventory import InventoryFile + + +@pytest.mark.sphinx(buildername='dirhtml', testroot='builder-dirhtml') +def test_dirhtml(app, status, warning): + app.build() + + assert (app.outdir / 'index.html').exists() + assert (app.outdir / 'foo/index.html').exists() + assert (app.outdir / 'foo/foo_1/index.html').exists() + assert (app.outdir / 'foo/foo_2/index.html').exists() + assert (app.outdir / 'bar/index.html').exists() + + content = (app.outdir / 'index.html').read_text(encoding='utf8') + assert 'href="foo/"' in content + assert 'href="foo/foo_1/"' in content + assert 'href="foo/foo_2/"' in content + assert 'href="bar/"' in content + + # objects.inv (refs: #7095) + with (app.outdir / 'objects.inv').open('rb') as f: + invdata = InventoryFile.load(f, 'path/to', posixpath.join) + + assert 'index' in invdata.get('std:doc') + assert invdata['std:doc']['index'] == ('Python', '', 'path/to/', '-') + + assert 'foo/index' in invdata.get('std:doc') + assert invdata['std:doc']['foo/index'] == ('Python', '', 'path/to/foo/', '-') + + assert 'index' in invdata.get('std:label') + assert invdata['std:label']['index'] == ('Python', '', 'path/to/#index', '-') + + assert 'foo' in invdata.get('std:label') + assert invdata['std:label']['foo'] == ('Python', '', 'path/to/foo/#foo', 'foo/index') diff --git a/tests/test_build_epub.py b/tests/test_build_epub.py new file mode 100644 index 0000000..7f5b815 --- /dev/null +++ b/tests/test_build_epub.py @@ -0,0 +1,411 @@ +"""Test the HTML builder and check output against XPath.""" + +import os +import subprocess +from pathlib import Path +from subprocess import CalledProcessError +from xml.etree import ElementTree + +import pytest + +from sphinx.builders.epub3 import _XML_NAME_PATTERN + + +# check given command is runnable +def runnable(command): + try: + subprocess.run(command, capture_output=True, check=True) + return True + except (OSError, CalledProcessError): + return False # command not found or exit with non-zero + + +class EPUBElementTree: + """Test helper for content.opf and toc.ncx""" + namespaces = { + 'idpf': 'http://www.idpf.org/2007/opf', + 'dc': 'http://purl.org/dc/elements/1.1/', + 'ibooks': 'http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/', + 'ncx': 'http://www.daisy.org/z3986/2005/ncx/', + 'xhtml': 'http://www.w3.org/1999/xhtml', + 'epub': 'http://www.idpf.org/2007/ops', + } + + def __init__(self, tree): + self.tree = tree + + @classmethod + def fromstring(cls, string): + tree = ElementTree.fromstring(string) # NoQA: S314 # using known data in tests + return cls(tree) + + def find(self, match): + ret = self.tree.find(match, namespaces=self.namespaces) + if ret is not None: + return self.__class__(ret) + else: + return ret + + def findall(self, match): + ret = self.tree.findall(match, namespaces=self.namespaces) + return [self.__class__(e) for e in ret] + + def __getattr__(self, name): + return getattr(self.tree, name) + + def __iter__(self): + for child in self.tree: + yield self.__class__(child) + + +@pytest.mark.sphinx('epub', testroot='basic') +def test_build_epub(app): + app.builder.build_all() + assert (app.outdir / 'mimetype').read_text(encoding='utf8') == 'application/epub+zip' + assert (app.outdir / 'META-INF' / 'container.xml').exists() + + # toc.ncx + toc = EPUBElementTree.fromstring((app.outdir / 'toc.ncx').read_text(encoding='utf8')) + assert toc.find("./ncx:docTitle/ncx:text").text == 'Python' + + # toc.ncx / head + meta = list(toc.find("./ncx:head")) + assert meta[0].attrib == {'name': 'dtb:uid', 'content': 'unknown'} + assert meta[1].attrib == {'name': 'dtb:depth', 'content': '1'} + assert meta[2].attrib == {'name': 'dtb:totalPageCount', 'content': '0'} + assert meta[3].attrib == {'name': 'dtb:maxPageNumber', 'content': '0'} + + # toc.ncx / navMap + navpoints = toc.findall("./ncx:navMap/ncx:navPoint") + assert len(navpoints) == 1 + assert navpoints[0].attrib == {'id': 'navPoint1', 'playOrder': '1'} + assert navpoints[0].find("./ncx:content").attrib == {'src': 'index.xhtml'} + + navlabel = navpoints[0].find("./ncx:navLabel/ncx:text") + assert navlabel.text == 'The basic Sphinx documentation for testing' + + # content.opf + opf = EPUBElementTree.fromstring((app.outdir / 'content.opf').read_text(encoding='utf8')) + + # content.opf / metadata + metadata = opf.find("./idpf:metadata") + assert metadata.find("./dc:language").text == 'en' + assert metadata.find("./dc:title").text == 'Python' + assert metadata.find("./dc:description").text == 'unknown' + assert metadata.find("./dc:creator").text == 'unknown' + assert metadata.find("./dc:contributor").text == 'unknown' + assert metadata.find("./dc:publisher").text == 'unknown' + assert metadata.find("./dc:rights").text is None + assert metadata.find("./idpf:meta[@property='ibooks:version']").text is None + assert metadata.find("./idpf:meta[@property='ibooks:specified-fonts']").text == 'true' + assert metadata.find("./idpf:meta[@property='ibooks:binding']").text == 'true' + assert metadata.find("./idpf:meta[@property='ibooks:scroll-axis']").text == 'vertical' + + # content.opf / manifest + manifest = opf.find("./idpf:manifest") + items = list(manifest) + assert items[0].attrib == {'id': 'ncx', + 'href': 'toc.ncx', + 'media-type': 'application/x-dtbncx+xml'} + assert items[1].attrib == {'id': 'nav', + 'href': 'nav.xhtml', + 'media-type': 'application/xhtml+xml', + 'properties': 'nav'} + assert items[2].attrib == {'id': 'epub-0', + 'href': 'genindex.xhtml', + 'media-type': 'application/xhtml+xml'} + assert items[3].attrib == {'id': 'epub-1', + 'href': 'index.xhtml', + 'media-type': 'application/xhtml+xml'} + + for i, item in enumerate(items[2:]): + # items are named as epub-NN + assert item.get('id') == 'epub-%d' % i + + # content.opf / spine + spine = opf.find("./idpf:spine") + itemrefs = list(spine) + assert spine.get('toc') == 'ncx' + assert spine.get('page-progression-direction') == 'ltr' + assert itemrefs[0].get('idref') == 'epub-1' + assert itemrefs[1].get('idref') == 'epub-0' + + # content.opf / guide + reference = opf.find("./idpf:guide/idpf:reference") + assert reference.get('type') == 'toc' + assert reference.get('title') == 'Table of Contents' + assert reference.get('href') == 'index.xhtml' + + # nav.xhtml + nav = EPUBElementTree.fromstring((app.outdir / 'nav.xhtml').read_text(encoding='utf8')) + assert nav.attrib == {'lang': 'en', + '{http://www.w3.org/XML/1998/namespace}lang': 'en'} + assert nav.find("./xhtml:head/xhtml:title").text == 'Table of Contents' + + # nav.xhtml / nav + navlist = nav.find("./xhtml:body/xhtml:nav") + toc = navlist.findall("./xhtml:ol/xhtml:li") + assert navlist.find("./xhtml:h1").text == 'Table of Contents' + assert len(toc) == 1 + assert toc[0].find("./xhtml:a").get("href") == 'index.xhtml' + assert toc[0].find("./xhtml:a").text == 'The basic Sphinx documentation for testing' + + +@pytest.mark.sphinx('epub', testroot='footnotes', + confoverrides={'epub_cover': ('_images/rimg.png', None)}) +def test_epub_cover(app): + app.build() + + # content.opf / metadata + opf = EPUBElementTree.fromstring((app.outdir / 'content.opf').read_text(encoding='utf8')) + cover_image = opf.find("./idpf:manifest/idpf:item[@href='%s']" % app.config.epub_cover[0]) + cover = opf.find("./idpf:metadata/idpf:meta[@name='cover']") + assert cover + assert cover.get('content') == cover_image.get('id') + + +@pytest.mark.sphinx('epub', testroot='toctree') +def test_nested_toc(app): + app.build() + + # toc.ncx + toc = EPUBElementTree.fromstring((app.outdir / 'toc.ncx').read_bytes()) + assert toc.find("./ncx:docTitle/ncx:text").text == 'Python' + + # toc.ncx / navPoint + def navinfo(elem): + label = elem.find("./ncx:navLabel/ncx:text") + content = elem.find("./ncx:content") + return (elem.get('id'), elem.get('playOrder'), + content.get('src'), label.text) + + navpoints = toc.findall("./ncx:navMap/ncx:navPoint") + assert len(navpoints) == 4 + assert navinfo(navpoints[0]) == ('navPoint1', '1', 'index.xhtml', + "Welcome to Sphinx Tests’s documentation!") + assert navpoints[0].findall("./ncx:navPoint") == [] + + # toc.ncx / nested navPoints + assert navinfo(navpoints[1]) == ('navPoint2', '2', 'foo.xhtml', 'foo') + navchildren = navpoints[1].findall("./ncx:navPoint") + assert len(navchildren) == 4 + assert navinfo(navchildren[0]) == ('navPoint3', '2', 'foo.xhtml', 'foo') + assert navinfo(navchildren[1]) == ('navPoint4', '3', 'quux.xhtml', 'quux') + assert navinfo(navchildren[2]) == ('navPoint5', '4', 'foo.xhtml#foo-1', 'foo.1') + assert navinfo(navchildren[3]) == ('navPoint8', '6', 'foo.xhtml#foo-2', 'foo.2') + + # nav.xhtml / nav + def navinfo(elem): + anchor = elem.find("./xhtml:a") + return (anchor.get('href'), anchor.text) + + nav = EPUBElementTree.fromstring((app.outdir / 'nav.xhtml').read_bytes()) + toc = nav.findall("./xhtml:body/xhtml:nav/xhtml:ol/xhtml:li") + assert len(toc) == 4 + assert navinfo(toc[0]) == ('index.xhtml', + "Welcome to Sphinx Tests’s documentation!") + assert toc[0].findall("./xhtml:ol") == [] + + # nav.xhtml / nested toc + assert navinfo(toc[1]) == ('foo.xhtml', 'foo') + tocchildren = toc[1].findall("./xhtml:ol/xhtml:li") + assert len(tocchildren) == 3 + assert navinfo(tocchildren[0]) == ('quux.xhtml', 'quux') + assert navinfo(tocchildren[1]) == ('foo.xhtml#foo-1', 'foo.1') + assert navinfo(tocchildren[2]) == ('foo.xhtml#foo-2', 'foo.2') + + grandchild = tocchildren[1].findall("./xhtml:ol/xhtml:li") + assert len(grandchild) == 1 + assert navinfo(grandchild[0]) == ('foo.xhtml#foo-1-1', 'foo.1-1') + + +@pytest.mark.sphinx('epub', testroot='need-escaped') +def test_escaped_toc(app): + app.build() + + # toc.ncx + toc = EPUBElementTree.fromstring((app.outdir / 'toc.ncx').read_bytes()) + assert toc.find("./ncx:docTitle/ncx:text").text == 'need "escaped" project' + + # toc.ncx / navPoint + def navinfo(elem): + label = elem.find("./ncx:navLabel/ncx:text") + content = elem.find("./ncx:content") + return (elem.get('id'), elem.get('playOrder'), + content.get('src'), label.text) + + navpoints = toc.findall("./ncx:navMap/ncx:navPoint") + assert len(navpoints) == 4 + assert navinfo(navpoints[0]) == ('navPoint1', '1', 'index.xhtml', + "Welcome to Sphinx Tests's documentation!") + assert navpoints[0].findall("./ncx:navPoint") == [] + + # toc.ncx / nested navPoints + assert navinfo(navpoints[1]) == ('navPoint2', '2', 'foo.xhtml', '') + navchildren = navpoints[1].findall("./ncx:navPoint") + assert len(navchildren) == 4 + assert navinfo(navchildren[0]) == ('navPoint3', '2', 'foo.xhtml', '') + assert navinfo(navchildren[1]) == ('navPoint4', '3', 'quux.xhtml', 'quux') + assert navinfo(navchildren[2]) == ('navPoint5', '4', 'foo.xhtml#foo-1', 'foo “1”') + assert navinfo(navchildren[3]) == ('navPoint8', '6', 'foo.xhtml#foo-2', 'foo.2') + + # nav.xhtml / nav + def navinfo(elem): + anchor = elem.find("./xhtml:a") + return (anchor.get('href'), anchor.text) + + nav = EPUBElementTree.fromstring((app.outdir / 'nav.xhtml').read_bytes()) + toc = nav.findall("./xhtml:body/xhtml:nav/xhtml:ol/xhtml:li") + assert len(toc) == 4 + assert navinfo(toc[0]) == ('index.xhtml', + "Welcome to Sphinx Tests's documentation!") + assert toc[0].findall("./xhtml:ol") == [] + + # nav.xhtml / nested toc + assert navinfo(toc[1]) == ('foo.xhtml', '') + tocchildren = toc[1].findall("./xhtml:ol/xhtml:li") + assert len(tocchildren) == 3 + assert navinfo(tocchildren[0]) == ('quux.xhtml', 'quux') + assert navinfo(tocchildren[1]) == ('foo.xhtml#foo-1', 'foo “1”') + assert navinfo(tocchildren[2]) == ('foo.xhtml#foo-2', 'foo.2') + + grandchild = tocchildren[1].findall("./xhtml:ol/xhtml:li") + assert len(grandchild) == 1 + assert navinfo(grandchild[0]) == ('foo.xhtml#foo-1-1', 'foo.1-1') + + +@pytest.mark.sphinx('epub', testroot='basic') +def test_epub_writing_mode(app): + # horizontal (default) + app.builder.build_all() + + # horizontal / page-progression-direction + opf = EPUBElementTree.fromstring((app.outdir / 'content.opf').read_text(encoding='utf8')) + assert opf.find("./idpf:spine").get('page-progression-direction') == 'ltr' + + # horizontal / ibooks:scroll-axis + metadata = opf.find("./idpf:metadata") + assert metadata.find("./idpf:meta[@property='ibooks:scroll-axis']").text == 'vertical' + + # horizontal / writing-mode (CSS) + css = (app.outdir / '_static' / 'epub.css').read_text(encoding='utf8') + assert 'writing-mode: horizontal-tb;' in css + + # vertical + app.config.epub_writing_mode = 'vertical' + (app.outdir / 'index.xhtml').unlink() # forcely rebuild + app.build() + + # vertical / page-progression-direction + opf = EPUBElementTree.fromstring((app.outdir / 'content.opf').read_text(encoding='utf8')) + assert opf.find("./idpf:spine").get('page-progression-direction') == 'rtl' + + # vertical / ibooks:scroll-axis + metadata = opf.find("./idpf:metadata") + assert metadata.find("./idpf:meta[@property='ibooks:scroll-axis']").text == 'horizontal' + + # vertical / writing-mode (CSS) + css = (app.outdir / '_static' / 'epub.css').read_text(encoding='utf8') + assert 'writing-mode: vertical-rl;' in css + + +@pytest.mark.sphinx('epub', testroot='epub-anchor-id') +def test_epub_anchor_id(app): + app.build() + + html = (app.outdir / 'index.xhtml').read_text(encoding='utf8') + assert ('

' + 'blah blah blah

' in html) + assert ('' + '

blah blah blah

' in html) + assert 'see ' in html + + +@pytest.mark.sphinx('epub', testroot='html_assets') +def test_epub_assets(app): + app.builder.build_all() + + # epub_sytlesheets (same as html_css_files) + content = (app.outdir / 'index.xhtml').read_text(encoding='utf8') + assert ('' + in content) + assert ('' in content) + + +@pytest.mark.sphinx('epub', testroot='html_assets', + confoverrides={'epub_css_files': ['css/epub.css']}) +def test_epub_css_files(app): + app.builder.build_all() + + # epub_css_files + content = (app.outdir / 'index.xhtml').read_text(encoding='utf8') + assert '' in content + + # files in html_css_files are not outputted + assert ('' + not in content) + assert ('' not in content) + + +@pytest.mark.sphinx('epub', testroot='roles-download') +def test_html_download_role(app, status, warning): + app.build() + assert not (app.outdir / '_downloads' / 'dummy.dat').exists() + + content = (app.outdir / 'index.xhtml').read_text(encoding='utf8') + assert ('
  • ' + 'dummy.dat

  • ' in content) + assert ('
  • ' + 'not_found.dat

  • ' in content) + assert ('
  • ' + 'Sphinx logo' + ' [http://www.sphinx-doc.org/en/master' + '/_static/sphinxheader.png]

  • ' in content) + + +@pytest.mark.sphinx('epub', testroot='toctree-duplicated') +def test_duplicated_toctree_entry(app, status, warning): + app.builder.build_all() + assert 'WARNING: duplicated ToC entry found: foo.xhtml' in warning.getvalue() + + +@pytest.mark.skipif('DO_EPUBCHECK' not in os.environ, + reason='Skipped because DO_EPUBCHECK is not set') +@pytest.mark.sphinx('epub') +def test_run_epubcheck(app): + app.build() + + epubcheck = os.environ.get('EPUBCHECK_PATH', '/usr/share/java/epubcheck.jar') + if runnable(['java', '-version']) and os.path.exists(epubcheck): + try: + subprocess.run(['java', '-jar', epubcheck, app.outdir / 'SphinxTests.epub'], + capture_output=True, check=True) + except CalledProcessError as exc: + print(exc.stdout.decode('utf-8')) + print(exc.stderr.decode('utf-8')) + msg = f'epubcheck exited with return code {exc.returncode}' + raise AssertionError(msg) from exc + + +def test_xml_name_pattern_check(): + assert _XML_NAME_PATTERN.match('id-pub') + assert _XML_NAME_PATTERN.match('webpage') + assert not _XML_NAME_PATTERN.match('1bfda21') + + +@pytest.mark.sphinx('epub', testroot='images') +def test_copy_images(app, status, warning): + app.build() + + images_dir = Path(app.outdir) / '_images' + images = {image.name for image in images_dir.rglob('*')} + images.discard('python-logo.png') + assert images == { + 'img.png', + 'rimg.png', + 'rimg1.png', + 'svgimg.svg', + 'testimäge.png', + } diff --git a/tests/test_build_gettext.py b/tests/test_build_gettext.py new file mode 100644 index 0000000..6d9154e --- /dev/null +++ b/tests/test_build_gettext.py @@ -0,0 +1,235 @@ +"""Test the build process with gettext builder with the test root.""" + +import gettext +import os +import re +import subprocess +import sys +from subprocess import CalledProcessError + +import pytest + +from sphinx.builders.gettext import Catalog, MsgOrigin + +if sys.version_info[:2] >= (3, 11): + from contextlib import chdir +else: + from sphinx.util.osutil import _chdir as chdir + +_MSGID_PATTERN = re.compile(r'msgid "(.*)"') + + +def msgid_getter(msgid): + if m := _MSGID_PATTERN.search(msgid): + return m[1] + return None + + +def test_Catalog_duplicated_message(): + catalog = Catalog() + catalog.add('hello', MsgOrigin('/path/to/filename', 1)) + catalog.add('hello', MsgOrigin('/path/to/filename', 1)) + catalog.add('hello', MsgOrigin('/path/to/filename', 2)) + catalog.add('hello', MsgOrigin('/path/to/yetanother', 1)) + catalog.add('world', MsgOrigin('/path/to/filename', 1)) + + assert len(list(catalog)) == 2 + + msg1, msg2 = list(catalog) + assert msg1.text == 'hello' + assert msg1.locations == [('/path/to/filename', 1), + ('/path/to/filename', 2), + ('/path/to/yetanother', 1)] + assert msg2.text == 'world' + assert msg2.locations == [('/path/to/filename', 1)] + + +@pytest.mark.sphinx('gettext', srcdir='root-gettext') +def test_build_gettext(app): + # Generic build; should fail only when the builder is horribly broken. + app.builder.build_all() + + # Do messages end up in the correct location? + # top-level documents end up in a message catalog + assert (app.outdir / 'extapi.pot').is_file() + # directory items are grouped into sections + assert (app.outdir / 'subdir.pot').is_file() + + # regression test for issue #960 + catalog = (app.outdir / 'markup.pot').read_text(encoding='utf8') + assert 'msgid "something, something else, something more"' in catalog + + +@pytest.mark.sphinx('gettext', srcdir='root-gettext') +def test_msgfmt(app): + app.builder.build_all() + + (app.outdir / 'en' / 'LC_MESSAGES').mkdir(parents=True, exist_ok=True) + with chdir(app.outdir): + try: + args = ['msginit', '--no-translator', '-i', 'markup.pot', '--locale', 'en_US'] + subprocess.run(args, capture_output=True, check=True) + except OSError: + pytest.skip() # most likely msginit was not found + except CalledProcessError as exc: + print(exc.stdout) + print(exc.stderr) + msg = f'msginit exited with return code {exc.returncode}' + raise AssertionError(msg) from exc + + assert (app.outdir / 'en_US.po').is_file(), 'msginit failed' + try: + args = ['msgfmt', 'en_US.po', + '-o', os.path.join('en', 'LC_MESSAGES', 'test_root.mo')] + subprocess.run(args, capture_output=True, check=True) + except OSError: + pytest.skip() # most likely msgfmt was not found + except CalledProcessError as exc: + print(exc.stdout) + print(exc.stderr) + msg = f'msgfmt exited with return code {exc.returncode}' + raise AssertionError(msg) from exc + + mo = app.outdir / 'en' / 'LC_MESSAGES' / 'test_root.mo' + assert mo.is_file(), 'msgfmt failed' + + _ = gettext.translation('test_root', app.outdir, languages=['en']).gettext + assert _("Testing various markup") == "Testing various markup" + + +@pytest.mark.sphinx( + 'gettext', testroot='intl', srcdir='gettext', + confoverrides={'gettext_compact': False}) +def test_gettext_index_entries(app): + # regression test for #976 + app.builder.build(['index_entries']) + + pot = (app.outdir / 'index_entries.pot').read_text(encoding='utf8') + msg_ids = list(filter(None, map(msgid_getter, pot.splitlines()))) + + assert msg_ids == [ + "i18n with index entries", + "index target section", + "this is :index:`Newsletter` target paragraph.", + "various index entries", + "That's all.", + "Mailing List", + "Newsletter", + "Recipients List", + "First", + "Second", + "Third", + "Entry", + "See", + ] + + +@pytest.mark.sphinx( + 'gettext', testroot='intl', srcdir='gettext', + confoverrides={'gettext_compact': False, + 'gettext_additional_targets': []}) +def test_gettext_disable_index_entries(app): + # regression test for #976 + app.env._pickled_doctree_cache.clear() # clear cache + app.builder.build(['index_entries']) + + pot = (app.outdir / 'index_entries.pot').read_text(encoding='utf8') + msg_ids = list(filter(None, map(msgid_getter, pot.splitlines()))) + + assert msg_ids == [ + "i18n with index entries", + "index target section", + "this is :index:`Newsletter` target paragraph.", + "various index entries", + "That's all.", + ] + + +@pytest.mark.sphinx('gettext', testroot='intl', srcdir='gettext') +def test_gettext_template(app): + app.builder.build_all() + + assert (app.outdir / 'sphinx.pot').is_file() + + result = (app.outdir / 'sphinx.pot').read_text(encoding='utf8') + assert "Welcome" in result + assert "Sphinx %(version)s" in result + + +@pytest.mark.sphinx('gettext', testroot='gettext-template') +def test_gettext_template_msgid_order_in_sphinxpot(app): + app.builder.build_all() + assert (app.outdir / 'sphinx.pot').is_file() + + result = (app.outdir / 'sphinx.pot').read_text(encoding='utf8') + assert re.search( + ('msgid "Template 1".*' + 'msgid "This is Template 1\\.".*' + 'msgid "Template 2".*' + 'msgid "This is Template 2\\.".*'), + result, + flags=re.DOTALL) + + +@pytest.mark.sphinx( + 'gettext', srcdir='root-gettext', + confoverrides={'gettext_compact': 'documentation'}) +def test_build_single_pot(app): + app.builder.build_all() + + assert (app.outdir / 'documentation.pot').is_file() + + result = (app.outdir / 'documentation.pot').read_text(encoding='utf8') + assert re.search( + ('msgid "Todo".*' + 'msgid "Like footnotes.".*' + 'msgid "The minute.".*' + 'msgid "Generated section".*'), + result, + flags=re.DOTALL) + + +@pytest.mark.sphinx( + 'gettext', + testroot='intl_substitution_definitions', + srcdir='gettext-subst', + confoverrides={'gettext_compact': False, + 'gettext_additional_targets': ['image']}) +def test_gettext_prolog_epilog_substitution(app): + app.builder.build_all() + + assert (app.outdir / 'prolog_epilog_substitution.pot').is_file() + pot = (app.outdir / 'prolog_epilog_substitution.pot').read_text(encoding='utf8') + msg_ids = list(filter(None, map(msgid_getter, pot.splitlines()))) + + assert msg_ids == [ + "i18n with prologue and epilogue substitutions", + "This is content that contains |subst_prolog_1|.", + "Substituted image |subst_prolog_2| here.", + "subst_prolog_2", + ".. image:: /img.png", + "This is content that contains |subst_epilog_1|.", + "Substituted image |subst_epilog_2| here.", + "subst_epilog_2", + ".. image:: /i18n.png", + ] + + +@pytest.mark.sphinx( + 'gettext', + testroot='intl_substitution_definitions', + srcdir='gettext-subst', + confoverrides={'gettext_compact': False, + 'gettext_additional_targets': ['image']}) +def test_gettext_prolog_epilog_substitution_excluded(app): + # regression test for #9428 + app.builder.build_all() + + assert (app.outdir / 'prolog_epilog_substitution_excluded.pot').is_file() + pot = (app.outdir / 'prolog_epilog_substitution_excluded.pot').read_text(encoding='utf8') + msg_ids = list(filter(None, map(msgid_getter, pot.splitlines()))) + + assert msg_ids == [ + "i18n without prologue and epilogue substitutions", + "This is content that does not include prologue and epilogue substitutions.", + ] diff --git a/tests/test_build_html.py b/tests/test_build_html.py new file mode 100644 index 0000000..07f101d --- /dev/null +++ b/tests/test_build_html.py @@ -0,0 +1,1841 @@ +"""Test the HTML builder and check output against XPath.""" + +import hashlib +import os +import posixpath +import re +from itertools import chain, cycle +from pathlib import Path +from unittest.mock import ANY, call, patch + +import pytest +from html5lib import HTMLParser + +import sphinx.builders.html +from sphinx.builders.html import validate_html_extra_path, validate_html_static_path +from sphinx.builders.html._assets import _file_checksum +from sphinx.errors import ConfigError, ThemeError +from sphinx.testing.util import strip_escseq +from sphinx.util.inventory import InventoryFile + +FIGURE_CAPTION = ".//figure/figcaption/p" + + +ENV_WARNINGS = """\ +%(root)s/autodoc_fodder.py:docstring of autodoc_fodder.MarkupError:\\d+: \ +WARNING: Explicit markup ends without a blank line; unexpected unindent. +%(root)s/index.rst:\\d+: WARNING: Encoding 'utf-8-sig' used for reading included \ +file '%(root)s/wrongenc.inc' seems to be wrong, try giving an :encoding: option +%(root)s/index.rst:\\d+: WARNING: invalid single index entry '' +%(root)s/index.rst:\\d+: WARNING: image file not readable: foo.png +%(root)s/index.rst:\\d+: WARNING: download file not readable: %(root)s/nonexisting.png +%(root)s/undecodable.rst:\\d+: WARNING: undecodable source characters, replacing \ +with "\\?": b?'here: >>>(\\\\|/)xbb<<<((\\\\|/)r)?' +""" + +HTML_WARNINGS = ENV_WARNINGS + """\ +%(root)s/index.rst:\\d+: WARNING: unknown option: '&option' +%(root)s/index.rst:\\d+: WARNING: citation not found: missing +%(root)s/index.rst:\\d+: WARNING: a suitable image for html builder not found: foo.\\* +%(root)s/index.rst:\\d+: WARNING: Lexing literal_block ".*" as "c" resulted in an error at token: ".*". Retrying in relaxed mode. +""" + + +etree_cache = {} + + +@pytest.fixture(scope='module') +def cached_etree_parse(): + def parse(fname): + if fname in etree_cache: + return etree_cache[fname] + with (fname).open('rb') as fp: + etree = HTMLParser(namespaceHTMLElements=False).parse(fp) + etree_cache.clear() + etree_cache[fname] = etree + return etree + yield parse + etree_cache.clear() + + +def flat_dict(d): + return chain.from_iterable( + [ + zip(cycle([fname]), values) + for fname, values in d.items() + ], + ) + + +def tail_check(check): + rex = re.compile(check) + + def checker(nodes): + for node in nodes: + if node.tail and rex.search(node.tail): + return True + msg = f'{check!r} not found in tail of any nodes {nodes}' + raise AssertionError(msg) + return checker + + +def check_xpath(etree, fname, path, check, be_found=True): + nodes = list(etree.findall(path)) + if check is None: + assert nodes == [], ('found any nodes matching xpath ' + '%r in file %s' % (path, fname)) + return + else: + assert nodes != [], ('did not find any node matching xpath ' + '%r in file %s' % (path, fname)) + if callable(check): + check(nodes) + elif not check: + # only check for node presence + pass + else: + def get_text(node): + if node.text is not None: + # the node has only one text + return node.text + else: + # 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: + if any(rex.search(get_text(node)) for node in nodes): + return + else: + if all(not rex.search(get_text(node)) for node in nodes): + return + + raise AssertionError('%r not found in any node matching ' + 'path %s in %s: %r' % (check, path, fname, + [node.text for node in nodes])) + + +@pytest.mark.sphinx('html', testroot='warnings') +def test_html_warnings(app, warning): + app.build() + html_warnings = strip_escseq(re.sub(re.escape(os.sep) + '{1,2}', '/', warning.getvalue())) + html_warnings_exp = HTML_WARNINGS % { + 'root': re.escape(app.srcdir.as_posix())} + assert re.match(html_warnings_exp + '$', html_warnings), \ + "Warnings don't match:\n" + \ + '--- Expected (regex):\n' + html_warnings_exp + \ + '--- Got:\n' + html_warnings + + +def test_html4_error(make_app, tmp_path): + (tmp_path / 'conf.py').write_text('', encoding='utf-8') + with pytest.raises( + ConfigError, + match='HTML 4 is no longer supported by Sphinx', + ): + make_app( + buildername='html', + srcdir=tmp_path, + confoverrides={'html4_writer': True}, + ) + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'images.html': [ + (".//img[@src='_images/img.png']", ''), + (".//img[@src='_images/img1.png']", ''), + (".//img[@src='_images/simg.png']", ''), + (".//img[@src='_images/svgimg.svg']", ''), + (".//a[@href='_sources/images.txt']", ''), + ], + 'subdir/images.html': [ + (".//img[@src='../_images/img1.png']", ''), + (".//img[@src='../_images/rimg.png']", ''), + ], + 'subdir/includes.html': [ + (".//a[@class='reference download internal']", ''), + (".//img[@src='../_images/img.png']", ''), + (".//p", 'This is an include file.'), + (".//pre/span", 'line 1'), + (".//pre/span", 'line 2'), + ], + 'includes.html': [ + (".//pre", 'Max Strauß'), + (".//a[@class='reference download internal']", ''), + (".//pre/span", '"quotes"'), + (".//pre/span", "'included'"), + (".//pre/span[@class='s2']", 'üöä'), + (".//div[@class='inc-pyobj1 highlight-text notranslate']//pre", + r'^class Foo:\n pass\n\s*$'), + (".//div[@class='inc-pyobj2 highlight-text notranslate']//pre", + r'^ def baz\(\):\n pass\n\s*$'), + (".//div[@class='inc-lines highlight-text notranslate']//pre", + r'^class Foo:\n pass\nclass Bar:\n$'), + (".//div[@class='inc-startend highlight-text notranslate']//pre", + '^foo = "Including Unicode characters: üöä"\\n$'), + (".//div[@class='inc-preappend highlight-text notranslate']//pre", + r'(?m)^START CODE$'), + (".//div[@class='inc-pyobj-dedent highlight-python notranslate']//span", + r'def'), + (".//div[@class='inc-tab3 highlight-text notranslate']//pre", + r'-| |-'), + (".//div[@class='inc-tab8 highlight-python notranslate']//pre/span", + r'-| |-'), + ], + 'autodoc.html': [ + (".//dl[@class='py class']/dt[@id='autodoc_target.Class']", ''), + (".//dl[@class='py function']/dt[@id='autodoc_target.function']/em/span/span", r'\*\*'), + (".//dl[@class='py function']/dt[@id='autodoc_target.function']/em/span/span", r'kwds'), + (".//dd/p", r'Return spam\.'), + ], + 'extapi.html': [ + (".//strong", 'from class: Bar'), + ], + 'markup.html': [ + (".//title", 'set by title directive'), + (".//p/em", 'Section author: Georg Brandl'), + (".//p/em", 'Module author: Georg Brandl'), + # created by the meta directive + (".//meta[@name='author'][@content='Me']", ''), + (".//meta[@name='keywords'][@content='docs, sphinx']", ''), + # a label created by ``.. _label:`` + (".//div[@id='label']", ''), + # code with standard code blocks + (".//pre", '^some code$'), + # an option list + (".//span[@class='option']", '--help'), + # admonitions + (".//p[@class='admonition-title']", 'My Admonition'), + (".//div[@class='admonition note']/p", 'Note text.'), + (".//div[@class='admonition warning']/p", 'Warning text.'), + # inline markup + (".//li/p/strong", r'^command\\n$'), + (".//li/p/strong", r'^program\\n$'), + (".//li/p/em", r'^dfn\\n$'), + (".//li/p/kbd", r'^kbd\\n$'), + (".//li/p/span", 'File \N{TRIANGULAR BULLET} Close'), + (".//li/p/code/span[@class='pre']", '^a/$'), + (".//li/p/code/em/span[@class='pre']", '^varpart$'), + (".//li/p/code/em/span[@class='pre']", '^i$'), + (".//a[@href='https://peps.python.org/pep-0008/']" + "[@class='pep reference external']/strong", 'PEP 8'), + (".//a[@href='https://peps.python.org/pep-0008/']" + "[@class='pep reference external']/strong", + 'Python Enhancement Proposal #8'), + (".//a[@href='https://datatracker.ietf.org/doc/html/rfc1.html']" + "[@class='rfc reference external']/strong", 'RFC 1'), + (".//a[@href='https://datatracker.ietf.org/doc/html/rfc1.html']" + "[@class='rfc reference external']/strong", 'Request for Comments #1'), + (".//a[@href='objects.html#envvar-HOME']" + "[@class='reference internal']/code/span[@class='pre']", 'HOME'), + (".//a[@href='#with']" + "[@class='reference internal']/code/span[@class='pre']", '^with$'), + (".//a[@href='#grammar-token-try_stmt']" + "[@class='reference internal']/code/span", '^statement$'), + (".//a[@href='#some-label'][@class='reference internal']/span", '^here$'), + (".//a[@href='#some-label'][@class='reference internal']/span", '^there$'), + (".//a[@href='subdir/includes.html']" + "[@class='reference internal']/span", 'Including in subdir'), + (".//a[@href='objects.html#cmdoption-python-c']" + "[@class='reference internal']/code/span[@class='pre']", '-c'), + # abbreviations + (".//abbr[@title='abbreviation']", '^abbr$'), + # version stuff + (".//div[@class='versionadded']/p/span", 'New in version 0.6: '), + (".//div[@class='versionadded']/p/span", + tail_check('First paragraph of versionadded')), + (".//div[@class='versionchanged']/p/span", + tail_check('First paragraph of versionchanged')), + (".//div[@class='versionchanged']/p", + 'Second paragraph of versionchanged'), + # footnote reference + (".//a[@class='footnote-reference brackets']", r'1'), + # created by reference lookup + (".//a[@href='index.html#ref1']", ''), + # ``seealso`` directive + (".//div/p[@class='admonition-title']", 'See also'), + # a ``hlist`` directive + (".//table[@class='hlist']/tbody/tr/td/ul/li/p", '^This$'), + # a ``centered`` directive + (".//p[@class='centered']/strong", 'LICENSE'), + # a glossary + (".//dl/dt[@id='term-boson']", 'boson'), + (".//dl/dt[@id='term-boson']/a", '¶'), + # a production list + (".//pre/strong", 'try_stmt'), + (".//pre/a[@href='#grammar-token-try1_stmt']/code/span", 'try1_stmt'), + # tests for ``only`` directive + (".//p", 'A global substitution!'), + (".//p", 'In HTML.'), + (".//p", 'In both.'), + (".//p", 'Always present'), + # tests for ``any`` role + (".//a[@href='#with']/span", 'headings'), + (".//a[@href='objects.html#func_without_body']/code/span", 'objects'), + # tests for numeric labels + (".//a[@href='#id1'][@class='reference internal']/span", 'Testing various markup'), + # tests for smartypants + (".//li/p", 'Smart “quotes” in English ‘text’.'), + (".//li/p", 'Smart — long and – short dashes.'), + (".//li/p", 'Ellipsis…'), + (".//li/p/code/span[@class='pre']", 'foo--"bar"...'), + (".//p", 'Этот «абзац» должен использовать „русские“ кавычки.'), + (".//p", 'Il dit : « C’est “super” ! »'), + ], + 'objects.html': [ + (".//dt[@id='mod.Cls.meth1']", ''), + (".//dt[@id='errmod.Error']", ''), + (".//dt/span[@class='sig-name descname']/span[@class='pre']", r'long\(parameter,'), + (".//dt/span[@class='sig-name descname']/span[@class='pre']", r'list\)'), + (".//dt/span[@class='sig-name descname']/span[@class='pre']", 'another'), + (".//dt/span[@class='sig-name descname']/span[@class='pre']", 'one'), + (".//a[@href='#mod.Cls'][@class='reference internal']", ''), + (".//dl[@class='std userdesc']", ''), + (".//dt[@id='userdesc-myobj']", ''), + (".//a[@href='#userdesc-myobj'][@class='reference internal']", ''), + # docfields + (".//a[@class='reference internal'][@href='#TimeInt']/em", 'TimeInt'), + (".//a[@class='reference internal'][@href='#Time']", 'Time'), + (".//a[@class='reference internal'][@href='#errmod.Error']/strong", 'Error'), + # C references + (".//span[@class='pre']", 'CFunction()'), + (".//a[@href='#c.Sphinx_DoSomething']", ''), + (".//a[@href='#c.SphinxStruct.member']", ''), + (".//a[@href='#c.SPHINX_USE_PYTHON']", ''), + (".//a[@href='#c.SphinxType']", ''), + (".//a[@href='#c.sphinx_global']", ''), + # test global TOC created by toctree() + (".//ul[@class='current']/li[@class='toctree-l1 current']/a[@href='#']", + 'Testing object descriptions'), + (".//li[@class='toctree-l1']/a[@href='markup.html']", + 'Testing various markup'), + # test unknown field names + (".//dt[@class='field-odd']", 'Field_name'), + (".//dt[@class='field-even']", 'Field_name all lower'), + (".//dt[@class='field-odd']", 'FIELD_NAME'), + (".//dt[@class='field-even']", 'FIELD_NAME ALL CAPS'), + (".//dt[@class='field-odd']", 'Field_Name'), + (".//dt[@class='field-even']", 'Field_Name All Word Caps'), + (".//dt[@class='field-odd']", 'Field_name'), + (".//dt[@class='field-even']", 'Field_name First word cap'), + (".//dt[@class='field-odd']", 'FIELd_name'), + (".//dt[@class='field-even']", 'FIELd_name PARTial caps'), + # custom sidebar + (".//h4", 'Custom sidebar'), + # docfields + (".//dd[@class='field-odd']/p/strong", '^moo$'), + (".//dd[@class='field-odd']/p/strong", tail_check(r'\(Moo\) .* Moo')), + (".//dd[@class='field-odd']/ul/li/p/strong", '^hour$'), + (".//dd[@class='field-odd']/ul/li/p/em", '^DuplicateType$'), + (".//dd[@class='field-odd']/ul/li/p/em", tail_check(r'.* Some parameter')), + # others + (".//a[@class='reference internal'][@href='#cmdoption-perl-arg-p']/code/span", + 'perl'), + (".//a[@class='reference internal'][@href='#cmdoption-perl-arg-p']/code/span", + '\\+p'), + (".//a[@class='reference internal'][@href='#cmdoption-perl-ObjC']/code/span", + '--ObjC\\+\\+'), + (".//a[@class='reference internal'][@href='#cmdoption-perl-plugin.option']/code/span", + '--plugin.option'), + (".//a[@class='reference internal'][@href='#cmdoption-perl-arg-create-auth-token']" + "/code/span", + 'create-auth-token'), + (".//a[@class='reference internal'][@href='#cmdoption-perl-arg-arg']/code/span", + 'arg'), + (".//a[@class='reference internal'][@href='#cmdoption-perl-j']/code/span", + '-j'), + (".//a[@class='reference internal'][@href='#cmdoption-hg-arg-commit']/code/span", + 'hg'), + (".//a[@class='reference internal'][@href='#cmdoption-hg-arg-commit']/code/span", + 'commit'), + (".//a[@class='reference internal'][@href='#cmdoption-git-commit-p']/code/span", + 'git'), + (".//a[@class='reference internal'][@href='#cmdoption-git-commit-p']/code/span", + 'commit'), + (".//a[@class='reference internal'][@href='#cmdoption-git-commit-p']/code/span", + '-p'), + ], + 'index.html': [ + (".//meta[@name='hc'][@content='hcval']", ''), + (".//meta[@name='hc_co'][@content='hcval_co']", ''), + (".//li[@class='toctree-l1']/a", 'Testing various markup'), + (".//li[@class='toctree-l2']/a", 'Inline markup'), + (".//title", 'Sphinx '), + (".//div[@class='footer']", 'copyright text credits'), + (".//a[@href='http://python.org/']" + "[@class='reference external']", ''), + (".//li/p/a[@href='genindex.html']/span", 'Index'), + (".//li/p/a[@href='py-modindex.html']/span", 'Module Index'), + # custom sidebar only for contents + (".//h4", 'Contents sidebar'), + # custom JavaScript + (".//script[@src='file://moo.js']", ''), + # URL in contents + (".//a[@class='reference external'][@href='http://sphinx-doc.org/']", + 'http://sphinx-doc.org/'), + (".//a[@class='reference external'][@href='http://sphinx-doc.org/latest/']", + 'Latest reference'), + # Indirect hyperlink targets across files + (".//a[@href='markup.html#some-label'][@class='reference internal']/span", + '^indirect hyperref$'), + ], + 'bom.html': [ + (".//title", " File with UTF-8 BOM"), + ], + 'extensions.html': [ + (".//a[@href='http://python.org/dev/']", "http://python.org/dev/"), + (".//a[@href='http://bugs.python.org/issue1000']", "issue 1000"), + (".//a[@href='http://bugs.python.org/issue1042']", "explicit caption"), + ], + 'genindex.html': [ + # index entries + (".//a/strong", "Main"), + (".//a/strong", "[1]"), + (".//a/strong", "Other"), + (".//a", "entry"), + (".//li/a", "double"), + ], + 'otherext.html': [ + (".//h1", "Generated section"), + (".//a[@href='_sources/otherext.foo.txt']", ''), + ], +})) +@pytest.mark.sphinx('html', tags=['testtag'], + confoverrides={'html_context.hckey_co': 'hcval_co'}) +@pytest.mark.test_params(shared_result='test_build_html_output') +def test_html5_output(app, cached_etree_parse, fname, expect): + app.build() + print(app.outdir / fname) + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (".//div[@class='citation']/span", r'Ref1'), + (".//div[@class='citation']/span", r'Ref_1'), + ], + 'footnote.html': [ + (".//a[@class='footnote-reference brackets'][@href='#id9'][@id='id1']", r"1"), + (".//a[@class='footnote-reference brackets'][@href='#id10'][@id='id2']", r"2"), + (".//a[@class='footnote-reference brackets'][@href='#foo'][@id='id3']", r"3"), + (".//a[@class='reference internal'][@href='#bar'][@id='id4']/span", r"\[bar\]"), + (".//a[@class='reference internal'][@href='#baz-qux'][@id='id5']/span", r"\[baz_qux\]"), + (".//a[@class='footnote-reference brackets'][@href='#id11'][@id='id6']", r"4"), + (".//a[@class='footnote-reference brackets'][@href='#id12'][@id='id7']", r"5"), + (".//aside[@class='footnote brackets']/span/a[@href='#id1']", r"1"), + (".//aside[@class='footnote brackets']/span/a[@href='#id2']", r"2"), + (".//aside[@class='footnote brackets']/span/a[@href='#id3']", r"3"), + (".//div[@class='citation']/span/a[@href='#id4']", r"bar"), + (".//div[@class='citation']/span/a[@href='#id5']", r"baz_qux"), + (".//aside[@class='footnote brackets']/span/a[@href='#id6']", r"4"), + (".//aside[@class='footnote brackets']/span/a[@href='#id7']", r"5"), + (".//aside[@class='footnote brackets']/span/a[@href='#id8']", r"6"), + ], +})) +@pytest.mark.sphinx('html') +@pytest.mark.test_params(shared_result='test_build_html_output_docutils18') +def test_docutils_output(app, cached_etree_parse, fname, expect): + app.build() + print(app.outdir / fname) + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.sphinx('html', parallel=2) +def test_html_parallel(app): + app.build() + + +@pytest.mark.sphinx('html') +@pytest.mark.test_params(shared_result='test_build_html_output') +def test_html_download(app): + app.build() + + # subdir/includes.html + result = (app.outdir / 'subdir' / 'includes.html').read_text(encoding='utf8') + pattern = ('
    ') + matched = re.search(pattern, result) + assert matched + assert (app.outdir / matched.group(1)).exists() + filename = matched.group(1) + + # includes.html + result = (app.outdir / 'includes.html').read_text(encoding='utf8') + pattern = ('') + matched = re.search(pattern, result) + assert matched + assert (app.outdir / matched.group(1)).exists() + assert matched.group(1) == filename + + pattern = ('') + matched = re.search(pattern, result) + assert matched + assert (app.outdir / matched.group(1) / "file_with_special_#_chars.xyz").exists() + + +@pytest.mark.sphinx('html', testroot='roles-download') +def test_html_download_role(app, status, warning): + app.build() + digest = hashlib.md5(b'dummy.dat', usedforsecurity=False).hexdigest() + assert (app.outdir / '_downloads' / digest / 'dummy.dat').exists() + digest_another = hashlib.md5(b'another/dummy.dat', usedforsecurity=False).hexdigest() + assert (app.outdir / '_downloads' / digest_another / 'dummy.dat').exists() + + content = (app.outdir / 'index.html').read_text(encoding='utf8') + assert (('
  • ' + '' + 'dummy.dat

  • ' % digest) + in content) + assert (('
  • ' + '' + 'another/dummy.dat

  • ' % + digest_another) in content) + assert ('
  • ' + 'not_found.dat

  • ' in content) + assert ('
  • ' + '' + 'Sphinx logo' + '

  • ' in content) + + +@pytest.mark.sphinx('html', testroot='build-html-translator') +def test_html_translator(app): + app.build() + assert app.builder.docwriter.visitor.depart_with_node == 10 + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (".//li[@class='toctree-l3']/a", '1.1.1. Foo A1', True), + (".//li[@class='toctree-l3']/a", '1.2.1. Foo B1', True), + (".//li[@class='toctree-l3']/a", '2.1.1. Bar A1', False), + (".//li[@class='toctree-l3']/a", '2.2.1. Bar B1', False), + ], + 'foo.html': [ + (".//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", '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", 'Baz A', True), + (".//h1//span[@class='section-number']", '2.1.1. ', True), + ], +})) +@pytest.mark.sphinx('html', testroot='tocdepth') +@pytest.mark.test_params(shared_result='test_build_html_tocdepth') +def test_tocdepth(app, cached_etree_parse, fname, expect): + app.build() + # issue #1251 + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (".//li[@class='toctree-l3']/a", '1.1.1. Foo A1', True), + (".//li[@class='toctree-l3']/a", '1.2.1. Foo B1', True), + (".//li[@class='toctree-l3']/a", '2.1.1. Bar A1', False), + (".//li[@class='toctree-l3']/a", '2.2.1. Bar B1', False), + + # index.rst + (".//h1", 'test-tocdepth', True), + + # foo.rst + (".//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", '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", 'Baz A', True), + (".//h4//span[@class='section-number']", '2.1.1. ', True), + ], +})) +@pytest.mark.sphinx('singlehtml', testroot='tocdepth') +@pytest.mark.test_params(shared_result='test_build_html_tocdepth') +def test_tocdepth_singlehtml(app, cached_etree_parse, fname, expect): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.sphinx('html', testroot='numfig') +@pytest.mark.test_params(shared_result='test_build_html_numfig') +def test_numfig_disabled_warn(app, warning): + app.build() + warnings = warning.getvalue() + assert 'index.rst:47: WARNING: numfig is disabled. :numref: is ignored.' in warnings + assert 'index.rst:56: WARNING: invalid numfig_format: invalid' not in warnings + assert 'index.rst:57: WARNING: invalid numfig_format: Fig %s %s' not in warnings + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", None, True), + (".//table/caption/span[@class='caption-number']", None, True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", None, True), + (".//li/p/code/span", '^fig1$', True), + (".//li/p/code/span", '^Figure%s$', True), + (".//li/p/code/span", '^table-1$', True), + (".//li/p/code/span", '^Table:%s$', True), + (".//li/p/code/span", '^CODE_1$', True), + (".//li/p/code/span", '^Code-%s$', True), + (".//li/p/a/span", '^Section 1$', True), + (".//li/p/a/span", '^Section 2.1$', True), + (".//li/p/code/span", '^Fig.{number}$', True), + (".//li/p/a/span", '^Sect.1 Foo$', True), + ], + 'foo.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", None, True), + (".//table/caption/span[@class='caption-number']", None, True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", None, True), + ], + 'bar.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", None, True), + (".//table/caption/span[@class='caption-number']", None, True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", None, True), + ], + 'baz.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", None, True), + (".//table/caption/span[@class='caption-number']", None, True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", None, True), + ], +})) +@pytest.mark.sphinx('html', testroot='numfig') +@pytest.mark.test_params(shared_result='test_build_html_numfig') +def test_numfig_disabled(app, cached_etree_parse, fname, expect): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.sphinx( + 'html', testroot='numfig', + srcdir='test_numfig_without_numbered_toctree_warn', + confoverrides={'numfig': True}) +def test_numfig_without_numbered_toctree_warn(app, warning): + app.build() + # remove :numbered: option + index = (app.srcdir / 'index.rst').read_text(encoding='utf8') + index = re.sub(':numbered:.*', '', index) + (app.srcdir / 'index.rst').write_text(index, encoding='utf8') + app.build() + + warnings = warning.getvalue() + assert 'index.rst:47: WARNING: numfig is disabled. :numref: is ignored.' not in warnings + assert 'index.rst:55: WARNING: Failed to create a cross reference. Any number is not assigned: index' in warnings + assert 'index.rst:56: WARNING: invalid numfig_format: invalid' in warnings + assert 'index.rst:57: WARNING: invalid numfig_format: Fig %s %s' in warnings + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 9 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 10 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 9 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 10 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 9 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 10 $', True), + (".//li/p/a/span", '^Fig. 9$', True), + (".//li/p/a/span", '^Figure6$', True), + (".//li/p/a/span", '^Table 9$', True), + (".//li/p/a/span", '^Table:6$', True), + (".//li/p/a/span", '^Listing 9$', True), + (".//li/p/a/span", '^Code-6$', True), + (".//li/p/code/span", '^foo$', True), + (".//li/p/code/span", '^bar_a$', True), + (".//li/p/a/span", '^Fig.9 should be Fig.1$', True), + (".//li/p/code/span", '^Sect.{number}$', True), + ], + 'foo.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 3 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 4 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 3 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 4 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 3 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 4 $', True), + ], + 'bar.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 5 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 7 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 8 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 5 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 7 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 8 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 5 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 7 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 8 $', True), + ], + 'baz.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 6 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 6 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 6 $', True), + ], +})) +@pytest.mark.sphinx( + 'html', testroot='numfig', + srcdir='test_numfig_without_numbered_toctree', + confoverrides={'numfig': True}) +def test_numfig_without_numbered_toctree(app, cached_etree_parse, fname, expect): + # remove :numbered: option + index = (app.srcdir / 'index.rst').read_text(encoding='utf8') + index = re.sub(':numbered:.*', '', index) + (app.srcdir / 'index.rst').write_text(index, encoding='utf8') + + if not os.listdir(app.outdir): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.sphinx('html', testroot='numfig', confoverrides={'numfig': True}) +@pytest.mark.test_params(shared_result='test_build_html_numfig_on') +def test_numfig_with_numbered_toctree_warn(app, warning): + app.build() + warnings = warning.getvalue() + assert 'index.rst:47: WARNING: numfig is disabled. :numref: is ignored.' not in warnings + assert 'index.rst:55: WARNING: Failed to create a cross reference. Any number is not assigned: index' in warnings + assert 'index.rst:56: WARNING: invalid numfig_format: invalid' in warnings + assert 'index.rst:57: WARNING: invalid numfig_format: Fig %s %s' in warnings + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2 $', True), + (".//li/p/a/span", '^Fig. 1$', True), + (".//li/p/a/span", '^Figure2.2$', True), + (".//li/p/a/span", '^Table 1$', True), + (".//li/p/a/span", '^Table:2.2$', True), + (".//li/p/a/span", '^Listing 1$', True), + (".//li/p/a/span", '^Code-2.2$', True), + (".//li/p/a/span", '^Section.1$', True), + (".//li/p/a/span", '^Section.2.1$', True), + (".//li/p/a/span", '^Fig.1 should be Fig.1$', True), + (".//li/p/a/span", '^Sect.1 Foo$', True), + ], + 'foo.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.2 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.3 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.4 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.3 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.4 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.3 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.4 $', True), + ], + 'bar.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.3 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.4 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.3 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.4 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.3 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.4 $', True), + ], + 'baz.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.2 $', True), + ], +})) +@pytest.mark.sphinx('html', testroot='numfig', confoverrides={'numfig': True}) +@pytest.mark.test_params(shared_result='test_build_html_numfig_on') +def test_numfig_with_numbered_toctree(app, cached_etree_parse, fname, expect): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.sphinx('html', testroot='numfig', confoverrides={ + 'numfig': True, + 'numfig_format': {'figure': 'Figure:%s', + 'table': 'Tab_%s', + 'code-block': 'Code-%s', + 'section': 'SECTION-%s'}}) +@pytest.mark.test_params(shared_result='test_build_html_numfig_format_warn') +def test_numfig_with_prefix_warn(app, warning): + app.build() + warnings = warning.getvalue() + assert 'index.rst:47: WARNING: numfig is disabled. :numref: is ignored.' not in warnings + assert 'index.rst:55: WARNING: Failed to create a cross reference. Any number is not assigned: index' in warnings + assert 'index.rst:56: WARNING: invalid numfig_format: invalid' in warnings + assert 'index.rst:57: WARNING: invalid numfig_format: Fig %s %s' in warnings + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-2 $', True), + (".//li/p/a/span", '^Figure:1$', True), + (".//li/p/a/span", '^Figure2.2$', True), + (".//li/p/a/span", '^Tab_1$', True), + (".//li/p/a/span", '^Table:2.2$', True), + (".//li/p/a/span", '^Code-1$', True), + (".//li/p/a/span", '^Code-2.2$', True), + (".//li/p/a/span", '^SECTION-1$', True), + (".//li/p/a/span", '^SECTION-2.1$', True), + (".//li/p/a/span", '^Fig.1 should be Fig.1$', True), + (".//li/p/a/span", '^Sect.1 Foo$', True), + ], + 'foo.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1.2 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1.3 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:1.4 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_1.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_1.2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_1.3 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_1.4 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-1.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-1.2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-1.3 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-1.4 $', True), + ], + 'bar.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2.3 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2.4 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_2.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_2.3 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_2.4 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-2.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-2.3 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-2.4 $', True), + ], + 'baz.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Figure:2.2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Tab_2.2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Code-2.2 $', True), + ], +})) +@pytest.mark.sphinx('html', testroot='numfig', + confoverrides={'numfig': True, + 'numfig_format': {'figure': 'Figure:%s', + 'table': 'Tab_%s', + 'code-block': 'Code-%s', + 'section': 'SECTION-%s'}}) +@pytest.mark.test_params(shared_result='test_build_html_numfig_format_warn') +def test_numfig_with_prefix(app, cached_etree_parse, fname, expect): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.sphinx('html', testroot='numfig', + confoverrides={'numfig': True, 'numfig_secnum_depth': 2}) +@pytest.mark.test_params(shared_result='test_build_html_numfig_depth_2') +def test_numfig_with_secnum_depth_warn(app, warning): + app.build() + warnings = warning.getvalue() + assert 'index.rst:47: WARNING: numfig is disabled. :numref: is ignored.' not in warnings + assert 'index.rst:55: WARNING: Failed to create a cross reference. Any number is not assigned: index' in warnings + assert 'index.rst:56: WARNING: invalid numfig_format: invalid' in warnings + assert 'index.rst:57: WARNING: invalid numfig_format: Fig %s %s' in warnings + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2 $', True), + (".//li/p/a/span", '^Fig. 1$', True), + (".//li/p/a/span", '^Figure2.1.2$', True), + (".//li/p/a/span", '^Table 1$', True), + (".//li/p/a/span", '^Table:2.1.2$', True), + (".//li/p/a/span", '^Listing 1$', True), + (".//li/p/a/span", '^Code-2.1.2$', True), + (".//li/p/a/span", '^Section.1$', True), + (".//li/p/a/span", '^Section.2.1$', True), + (".//li/p/a/span", '^Fig.1 should be Fig.1$', True), + (".//li/p/a/span", '^Sect.1 Foo$', True), + ], + 'foo.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1.2 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.2.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.1.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.1.2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.2.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.1.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.1.2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.2.1 $', True), + ], + 'bar.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1.3 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.2.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.1.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.1.3 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.2.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.1.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.1.3 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.2.1 $', True), + ], + 'baz.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1.2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.1.2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.1.2 $', True), + ], +})) +@pytest.mark.sphinx('html', testroot='numfig', + confoverrides={'numfig': True, + 'numfig_secnum_depth': 2}) +@pytest.mark.test_params(shared_result='test_build_html_numfig_depth_2') +def test_numfig_with_secnum_depth(app, cached_etree_parse, fname, expect): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2 $', True), + (".//li/p/a/span", '^Fig. 1$', True), + (".//li/p/a/span", '^Figure2.2$', True), + (".//li/p/a/span", '^Table 1$', True), + (".//li/p/a/span", '^Table:2.2$', True), + (".//li/p/a/span", '^Listing 1$', True), + (".//li/p/a/span", '^Code-2.2$', True), + (".//li/p/a/span", '^Section.1$', True), + (".//li/p/a/span", '^Section.2.1$', True), + (".//li/p/a/span", '^Fig.1 should be Fig.1$', True), + (".//li/p/a/span", '^Sect.1 Foo$', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.2 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.3 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 1.4 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.3 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 1.4 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.3 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 1.4 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.1 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.3 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.4 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.1 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.3 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.4 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.1 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.3 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.4 $', True), + (FIGURE_CAPTION + "/span[@class='caption-number']", '^Fig. 2.2 $', True), + (".//table/caption/span[@class='caption-number']", + '^Table 2.2 $', True), + (".//div[@class='code-block-caption']/" + "span[@class='caption-number']", '^Listing 2.2 $', True), + ], +})) +@pytest.mark.sphinx('singlehtml', testroot='numfig', confoverrides={'numfig': True}) +@pytest.mark.test_params(shared_result='test_build_html_numfig_on') +def test_numfig_with_singlehtml(app, cached_etree_parse, fname, expect): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (FIGURE_CAPTION + "//span[@class='caption-number']", "Fig. 1", True), + (FIGURE_CAPTION + "//span[@class='caption-number']", "Fig. 2", True), + (FIGURE_CAPTION + "//span[@class='caption-number']", "Fig. 3", True), + (".//div//span[@class='caption-number']", "No.1 ", True), + (".//div//span[@class='caption-number']", "No.2 ", True), + (".//li/p/a/span", 'Fig. 1', True), + (".//li/p/a/span", 'Fig. 2', True), + (".//li/p/a/span", 'Fig. 3', True), + (".//li/p/a/span", 'No.1', True), + (".//li/p/a/span", 'No.2', True), + ], +})) +@pytest.mark.sphinx('html', testroot='add_enumerable_node', + srcdir='test_enumerable_node') +def test_enumerable_node(app, cached_etree_parse, fname, expect): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.sphinx('html', testroot='html_assets') +def test_html_assets(app): + app.builder.build_all() + + # exclude_path and its family + assert not (app.outdir / 'static' / 'index.html').exists() + assert not (app.outdir / 'extra' / 'index.html').exists() + + # html_static_path + assert not (app.outdir / '_static' / '.htaccess').exists() + assert not (app.outdir / '_static' / '.htpasswd').exists() + assert (app.outdir / '_static' / 'API.html').exists() + assert (app.outdir / '_static' / 'API.html').read_text(encoding='utf8') == 'Sphinx-1.4.4' + assert (app.outdir / '_static' / 'css' / 'style.css').exists() + assert (app.outdir / '_static' / 'js' / 'custom.js').exists() + assert (app.outdir / '_static' / 'rimg.png').exists() + assert not (app.outdir / '_static' / '_build' / 'index.html').exists() + assert (app.outdir / '_static' / 'background.png').exists() + assert not (app.outdir / '_static' / 'subdir' / '.htaccess').exists() + assert not (app.outdir / '_static' / 'subdir' / '.htpasswd').exists() + + # html_extra_path + assert (app.outdir / '.htaccess').exists() + assert not (app.outdir / '.htpasswd').exists() + assert (app.outdir / 'API.html_t').exists() + assert (app.outdir / 'css/style.css').exists() + assert (app.outdir / 'rimg.png').exists() + assert not (app.outdir / '_build' / 'index.html').exists() + assert (app.outdir / 'background.png').exists() + assert (app.outdir / 'subdir' / '.htaccess').exists() + assert not (app.outdir / 'subdir' / '.htpasswd').exists() + + # html_css_files + content = (app.outdir / 'index.html').read_text(encoding='utf8') + assert '' in content + assert ('' in content) + + # html_js_files + assert '' in content + assert ('' in content) + + +@pytest.mark.sphinx('html', testroot='html_assets') +def test_assets_order(app, monkeypatch): + monkeypatch.setattr(sphinx.builders.html, '_file_checksum', lambda o, f: '') + + app.add_css_file('normal.css') + app.add_css_file('early.css', priority=100) + app.add_css_file('late.css', priority=750) + app.add_css_file('lazy.css', priority=900) + app.add_js_file('normal.js') + app.add_js_file('early.js', priority=100) + app.add_js_file('late.js', priority=750) + app.add_js_file('lazy.js', priority=900) + + app.builder.build_all() + content = (app.outdir / 'index.html').read_text(encoding='utf8') + + # css_files + expected = [ + '_static/early.css', + '_static/pygments.css', + '_static/alabaster.css', + 'https://example.com/custom.css', + '_static/normal.css', + '_static/late.css', + '_static/css/style.css', + '_static/lazy.css', + ] + pattern = '.*'.join(f'href="{re.escape(f)}"' for f in expected) + assert re.search(pattern, content, re.DOTALL), content + + # js_files + expected = [ + '_static/early.js', + '_static/doctools.js', + '_static/sphinx_highlight.js', + 'https://example.com/script.js', + '_static/normal.js', + '_static/late.js', + '_static/js/custom.js', + '_static/lazy.js', + ] + pattern = '.*'.join(f'src="{re.escape(f)}"' for f in expected) + assert re.search(pattern, content, re.DOTALL), content + + +@pytest.mark.sphinx('html', testroot='html_file_checksum') +def test_file_checksum(app): + app.add_css_file('stylesheet-a.css') + app.add_css_file('stylesheet-b.css') + app.add_css_file('https://example.com/custom.css') + app.add_js_file('script.js') + app.add_js_file('empty.js') + app.add_js_file('https://example.com/script.js') + + app.builder.build_all() + content = (app.outdir / 'index.html').read_text(encoding='utf8') + + # checksum for local files + assert '' in content + assert '' in content + assert '' in content + + # empty files have no checksum + assert '' in content + + # no checksum for hyperlinks + assert '' in content + assert '' in content + + +def test_file_checksum_query_string(): + with pytest.raises(ThemeError, match='Local asset file paths must not contain query strings'): + _file_checksum(Path(), 'with_query_string.css?dead_parrots=1') + + with pytest.raises(ThemeError, match='Local asset file paths must not contain query strings'): + _file_checksum(Path(), 'with_query_string.js?dead_parrots=1') + + with pytest.raises(ThemeError, match='Local asset file paths must not contain query strings'): + _file_checksum(Path.cwd(), '_static/with_query_string.css?dead_parrots=1') + + with pytest.raises(ThemeError, match='Local asset file paths must not contain query strings'): + _file_checksum(Path.cwd(), '_static/with_query_string.js?dead_parrots=1') + + +@pytest.mark.sphinx('html', testroot='html_assets') +def test_javscript_loading_method(app): + app.add_js_file('normal.js') + app.add_js_file('early.js', loading_method='async') + app.add_js_file('late.js', loading_method='defer') + + app.builder.build_all() + content = (app.outdir / 'index.html').read_text(encoding='utf8') + + assert '' in content + assert '' in content + assert '' in content + + +@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_copy_source': False}) +def test_html_copy_source(app): + app.builder.build_all() + assert not (app.outdir / '_sources' / 'index.rst.txt').exists() + + +@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_sourcelink_suffix': '.txt'}) +def test_html_sourcelink_suffix(app): + app.builder.build_all() + assert (app.outdir / '_sources' / 'index.rst.txt').exists() + + +@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_sourcelink_suffix': '.rst'}) +def test_html_sourcelink_suffix_same(app): + app.builder.build_all() + assert (app.outdir / '_sources' / 'index.rst').exists() + + +@pytest.mark.sphinx('html', testroot='basic', confoverrides={'html_sourcelink_suffix': ''}) +def test_html_sourcelink_suffix_empty(app): + app.builder.build_all() + assert (app.outdir / '_sources' / 'index.rst').exists() + + +@pytest.mark.sphinx('html', testroot='html_entity') +def test_html_entity(app): + app.builder.build_all() + valid_entities = {'amp', 'lt', 'gt', 'quot', 'apos'} + content = (app.outdir / 'index.html').read_text(encoding='utf8') + for entity in re.findall(r'&([a-z]+);', content, re.M): + assert entity not in valid_entities + + +@pytest.mark.sphinx('html', testroot='basic') +def test_html_inventory(app): + app.builder.build_all() + + with app.outdir.joinpath('objects.inv').open('rb') as f: + invdata = InventoryFile.load(f, 'https://www.google.com', posixpath.join) + + assert set(invdata.keys()) == {'std:label', 'std:doc'} + assert set(invdata['std:label'].keys()) == {'modindex', + 'py-modindex', + 'genindex', + 'search'} + assert invdata['std:label']['modindex'] == ('Python', + '', + 'https://www.google.com/py-modindex.html', + 'Module Index') + assert invdata['std:label']['py-modindex'] == ('Python', + '', + 'https://www.google.com/py-modindex.html', + 'Python Module Index') + assert invdata['std:label']['genindex'] == ('Python', + '', + 'https://www.google.com/genindex.html', + 'Index') + assert invdata['std:label']['search'] == ('Python', + '', + 'https://www.google.com/search.html', + 'Search Page') + assert set(invdata['std:doc'].keys()) == {'index'} + assert invdata['std:doc']['index'] == ('Python', + '', + 'https://www.google.com/index.html', + 'The basic Sphinx documentation for testing') + + +@pytest.mark.sphinx('html', testroot='images', confoverrides={'html_sourcelink_suffix': ''}) +def test_html_anchor_for_figure(app): + app.builder.build_all() + content = (app.outdir / 'index.html').read_text(encoding='utf8') + assert ('
    \n

    The caption of pic' + '

    \n
    ' + in content) + + +@pytest.mark.sphinx('html', testroot='directives-raw') +def test_html_raw_directive(app, status, warning): + app.builder.build_all() + result = (app.outdir / 'index.html').read_text(encoding='utf8') + + # standard case + assert 'standalone raw directive (HTML)' in result + assert 'standalone raw directive (LaTeX)' not in result + + # with substitution + assert '

    HTML: abc def ghi

    ' in result + assert '

    LaTeX: abc ghi

    ' in result + + +@pytest.mark.parametrize(("fname", "expect"), flat_dict({ + 'index.html': [ + (".//link[@href='_static/persistent.css']" + "[@rel='stylesheet']", '', True), + (".//link[@href='_static/default.css']" + "[@rel='stylesheet']" + "[@title='Default']", '', True), + (".//link[@href='_static/alternate1.css']" + "[@rel='alternate stylesheet']" + "[@title='Alternate']", '', True), + (".//link[@href='_static/alternate2.css']" + "[@rel='alternate stylesheet']", '', True), + (".//link[@href='_static/more_persistent.css']" + "[@rel='stylesheet']", '', True), + (".//link[@href='_static/more_default.css']" + "[@rel='stylesheet']" + "[@title='Default']", '', True), + (".//link[@href='_static/more_alternate1.css']" + "[@rel='alternate stylesheet']" + "[@title='Alternate']", '', True), + (".//link[@href='_static/more_alternate2.css']" + "[@rel='alternate stylesheet']", '', True), + ], +})) +@pytest.mark.sphinx('html', testroot='stylesheets') +def test_alternate_stylesheets(app, cached_etree_parse, fname, expect): + app.build() + check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) + + +@pytest.mark.sphinx('html', testroot='html_style') +def test_html_style(app, status, warning): + app.build() + result = (app.outdir / 'index.html').read_text(encoding='utf8') + assert '' in result + assert ('' + not in result) + + +@pytest.mark.sphinx('html', testroot='images') +def test_html_remote_images(app, status, warning): + app.builder.build_all() + + result = (app.outdir / 'index.html').read_text(encoding='utf8') + assert ('https://www.python.org/static/img/python-logo.png' in result) + assert not (app.outdir / 'python-logo.png').exists() + + +@pytest.mark.sphinx('html', testroot='image-escape') +def test_html_encoded_image(app, status, warning): + app.builder.build_all() + + result = (app.outdir / 'index.html').read_text(encoding='utf8') + assert ('_images/img_%231.png' in result) + assert (app.outdir / '_images/img_#1.png').exists() + + +@pytest.mark.sphinx('html', testroot='remote-logo') +def test_html_remote_logo(app, status, warning): + app.builder.build_all() + + result = (app.outdir / 'index.html').read_text(encoding='utf8') + assert ('' in result) + assert ('' in result) + assert not (app.outdir / 'python-logo.png').exists() + + +@pytest.mark.sphinx('html', testroot='local-logo') +def test_html_local_logo(app, status, warning): + app.builder.build_all() + + result = (app.outdir / 'index.html').read_text(encoding='utf8') + assert ('' in result) + assert (app.outdir / '_static/img.png').exists() + + +@pytest.mark.sphinx('html', testroot='basic') +def test_html_sidebar(app, status, warning): + ctx = {} + + # default for alabaster + app.builder.build_all() + result = (app.outdir / 'index.html').read_text(encoding='utf8') + assert ('