diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-05-07 21:27:47 +0900 |
|---|---|---|
| committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2022-05-07 21:27:47 +0900 |
| commit | 5344b1b2415cae2fa48247cfe51b4bc458e1dee2 (patch) | |
| tree | 310707a0c2c6479efef90c16053ca8ab35113f77 /tests/roots | |
| parent | 07b2a050c75a6f46975407add941dc9be5a5a983 (diff) | |
| parent | 3bc1a3389266cc2f29930ec2efb5b9add0cdbadc (diff) | |
| download | sphinx-git-5344b1b2415cae2fa48247cfe51b4bc458e1dee2.tar.gz | |
Merge branch '5.x' into 10258_autosummary
Diffstat (limited to 'tests/roots')
18 files changed, 122 insertions, 8 deletions
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 000000000..e69de29bb --- /dev/null +++ b/tests/roots/test-apidoc-duplicates/fish_licence/halibut.cpython-38-x86_64-linux-gnu.so 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 000000000..e69de29bb --- /dev/null +++ b/tests/roots/test-apidoc-duplicates/fish_licence/halibut.pyx diff --git a/tests/roots/test-apidoc-toc/mypackage/main.py b/tests/roots/test-apidoc-toc/mypackage/main.py index c43573a38..d448cc847 100755 --- a/tests/roots/test-apidoc-toc/mypackage/main.py +++ b/tests/roots/test-apidoc-toc/mypackage/main.py @@ -10,6 +10,6 @@ if __name__ == "__main__": res_path = \ os.path.join(os.path.dirname(mod_resource.__file__), 'resource.txt') - with open(res_path) as f: + with open(res_path, encoding='utf-8') as f: text = f.read() print("From mod_resource:resource.txt -> {}".format(text)) diff --git a/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py b/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py index d8a2fecef..f2c07a0c7 100644 --- a/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py +++ b/tests/roots/test-ext-autodoc/target/autodoc_type_aliases.py @@ -1,7 +1,7 @@ from __future__ import annotations import io -from typing import overload +from typing import Optional, overload myint = int @@ -11,6 +11,9 @@ variable: myint #: docstring variable2 = None # type: myint +#: docstring +variable3: Optional[myint] + def read(r: io.BytesIO) -> io.StringIO: """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/docstring_signature.py b/tests/roots/test-ext-autodoc/target/docstring_signature.py index d9deb6244..981d936cd 100644 --- a/tests/roots/test-ext-autodoc/target/docstring_signature.py +++ b/tests/roots/test-ext-autodoc/target/docstring_signature.py @@ -22,10 +22,12 @@ class D: class E: def __init__(self): """E(foo: int, bar: int, baz: int) -> None \\ - E(foo: str, bar: str, baz: str) -> 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: str, bar: str, baz: str) -> None + F(foo: float, bar: float, baz: float)""" diff --git a/tests/roots/test-ext-autodoc/target/inheritance.py b/tests/roots/test-ext-autodoc/target/inheritance.py index ffac84bb6..485a943c8 100644 --- a/tests/roots/test-ext-autodoc/target/inheritance.py +++ b/tests/roots/test-ext-autodoc/target/inheritance.py @@ -15,3 +15,8 @@ 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/preserve_defaults.py b/tests/roots/test-ext-autodoc/target/preserve_defaults.py index 422d41b95..fc83cf4fc 100644 --- a/tests/roots/test-ext-autodoc/target/preserve_defaults.py +++ b/tests/roots/test-ext-autodoc/target/preserve_defaults.py @@ -8,7 +8,10 @@ SENTINEL = object() def foo(name: str = CONSTANT, sentinel: Any = SENTINEL, now: datetime = datetime.now(), - color: int = 0xFFFFFF) -> None: + color: int = 0xFFFFFF, + *, + kwarg1, + kwarg2 = 0xFFFFFF) -> None: """docstring""" @@ -16,5 +19,6 @@ class Class: """docstring""" def meth(self, name: str = CONSTANT, sentinel: Any = SENTINEL, - now: datetime = datetime.now(), color: int = 0xFFFFFF) -> None: + now: datetime = datetime.now(), color: int = 0xFFFFFF, + *, kwarg1, kwarg2 = 0xFFFFFF) -> None: """docstring""" diff --git a/tests/roots/test-ext-autodoc/target/singledispatch.py b/tests/roots/test-ext-autodoc/target/singledispatch.py index fca2b6683..3dd5aaf38 100644 --- a/tests/roots/test-ext-autodoc/target/singledispatch.py +++ b/tests/roots/test-ext-autodoc/target/singledispatch.py @@ -26,3 +26,11 @@ def _func_int(arg, kwarg=None): 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 index 086c7fe66..fb922936d 100644 --- a/tests/roots/test-ext-autodoc/target/singledispatchmethod.py +++ b/tests/roots/test-ext-autodoc/target/singledispatchmethod.py @@ -19,3 +19,9 @@ class Foo: 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-extlinks-hardcoded-urls-multiple-replacements/conf.py b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py index f97077300..f46344971 100644 --- a/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py +++ b/tests/roots/test-ext-extlinks-hardcoded-urls-multiple-replacements/conf.py @@ -3,3 +3,4 @@ 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/conf.py b/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py index 0fa9f8c76..db0b3410f 100644 --- a/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py +++ b/tests/roots/test-ext-extlinks-hardcoded-urls/conf.py @@ -1,2 +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-inheritance/dummy/test_nested.py b/tests/roots/test-inheritance/dummy/test_nested.py index 1e732aab5..89289fe44 100644 --- a/tests/roots/test-inheritance/dummy/test_nested.py +++ b/tests/roots/test-inheritance/dummy/test_nested.py @@ -1,5 +1,4 @@ -""" - Test with nested classes. +"""Test with nested classes. """ diff --git a/tests/roots/test-intl/literalblock.txt b/tests/roots/test-intl/literalblock.txt index 2b9eb8eb1..583b5b610 100644 --- a/tests/roots/test-intl/literalblock.txt +++ b/tests/roots/test-intl/literalblock.txt @@ -49,6 +49,14 @@ code blocks literal-block in list +.. highlight:: none + +:: + + test_code_for_noqa() + continued() + + doctest blocks ============== diff --git a/tests/roots/test-intl/noqa.txt b/tests/roots/test-intl/noqa.txt new file mode 100644 index 000000000..004b30146 --- /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/xx/LC_MESSAGES/literalblock.po b/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po index 040295359..8d3e5d8be 100644 --- a/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po +++ b/tests/roots/test-intl/xx/LC_MESSAGES/literalblock.po @@ -77,6 +77,12 @@ msgid "literal-block\n" 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" 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 000000000..1af66b47d --- /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 <Tests> package. +# FIRST AUTHOR <EMAIL@ADDRESS>, 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 <jean@abou-samra.fr>\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-reST-code-role/conf.py b/tests/roots/test-reST-code-role/conf.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/roots/test-reST-code-role/conf.py 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 000000000..5be6bfc57 --- /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 |
