refactor: autodoc: Remove needless spaces from blank line

This commit is contained in:
Takeshi KOMIYA
2020-03-08 15:31:14 +09:00
parent a73617c51b
commit 9ebad705b8
5 changed files with 252 additions and 249 deletions

View File

@@ -31,49 +31,49 @@ def test_autoclass_content_class(app):
' :module: target.autoclass_content',
'',
' A class having no __init__, no __new__',
' ',
'',
'',
'.. py:class:: B()',
' :module: target.autoclass_content',
'',
' A class having __init__(no docstring), no __new__',
' ',
'',
'',
'.. py:class:: C()',
' :module: target.autoclass_content',
'',
' A class having __init__, no __new__',
' ',
'',
'',
'.. py:class:: D',
' :module: target.autoclass_content',
'',
' A class having no __init__, __new__(no docstring)',
' ',
'',
'',
'.. py:class:: E',
' :module: target.autoclass_content',
'',
' A class having no __init__, __new__',
' ',
'',
'',
'.. py:class:: F()',
' :module: target.autoclass_content',
'',
' A class having both __init__ and __new__',
' ',
'',
'',
'.. py:class:: G()',
' :module: target.autoclass_content',
'',
' A class inherits __init__ without docstring.',
' ',
'',
'',
'.. py:class:: H()',
' :module: target.autoclass_content',
'',
' A class inherits __new__ without docstring.',
' '
'',
]
@@ -91,49 +91,49 @@ def test_autoclass_content_init(app):
' :module: target.autoclass_content',
'',
' A class having no __init__, no __new__',
' ',
'',
'',
'.. py:class:: B()',
' :module: target.autoclass_content',
'',
' A class having __init__(no docstring), no __new__',
' ',
'',
'',
'.. py:class:: C()',
' :module: target.autoclass_content',
'',
' __init__ docstring',
' ',
'',
'',
'.. py:class:: D',
' :module: target.autoclass_content',
'',
' A class having no __init__, __new__(no docstring)',
' ',
'',
'',
'.. py:class:: E',
' :module: target.autoclass_content',
'',
' __new__ docstring',
' ',
'',
'',
'.. py:class:: F()',
' :module: target.autoclass_content',
'',
' __init__ docstring',
' ',
'',
'',
'.. py:class:: G()',
' :module: target.autoclass_content',
'',
' __init__ docstring',
' ',
'',
'',
'.. py:class:: H()',
' :module: target.autoclass_content',
'',
' __new__ docstring',
' '
'',
]
@@ -151,59 +151,59 @@ def test_autoclass_content_both(app):
' :module: target.autoclass_content',
'',
' A class having no __init__, no __new__',
' ',
'',
'',
'.. py:class:: B()',
' :module: target.autoclass_content',
'',
' A class having __init__(no docstring), no __new__',
' ',
'',
'',
'.. py:class:: C()',
' :module: target.autoclass_content',
'',
' A class having __init__, no __new__',
' ',
'',
' __init__ docstring',
' ',
'',
'',
'.. py:class:: D',
' :module: target.autoclass_content',
'',
' A class having no __init__, __new__(no docstring)',
' ',
'',
'',
'.. py:class:: E',
' :module: target.autoclass_content',
'',
' A class having no __init__, __new__',
' ',
'',
' __new__ docstring',
' ',
'',
'',
'.. py:class:: F()',
' :module: target.autoclass_content',
'',
' A class having both __init__ and __new__',
' ',
'',
' __init__ docstring',
' ',
'',
'',
'.. py:class:: G()',
' :module: target.autoclass_content',
'',
' A class inherits __init__ without docstring.',
' ',
'',
' __init__ docstring',
' ',
'',
'',
'.. py:class:: H()',
' :module: target.autoclass_content',
'',
' A class inherits __new__ without docstring.',
' ',
'',
' __new__ docstring',
' '
'',
]
@@ -217,7 +217,7 @@ def test_autodoc_inherit_docstrings(app):
' :module: target.inheritance',
'',
' Inherited function.',
' '
'',
]
# disable autodoc_inherit_docstrings
@@ -240,38 +240,38 @@ def test_autodoc_docstring_signature(app):
'.. py:class:: DocstringSig',
' :module: target',
'',
' ',
'',
' .. py:method:: DocstringSig.meth(FOO, BAR=1) -> BAZ',
' :module: target',
' ',
'',
' First line of docstring',
' ',
'',
' rest of docstring',
' ',
' ',
'',
'',
' .. py:method:: DocstringSig.meth2()',
' :module: target',
' ',
'',
' First line, no signature',
' Second line followed by indentation::',
' ',
'',
' indented line',
' ',
' ',
'',
'',
' .. py:method:: DocstringSig.prop1',
' :module: target',
' :property:',
' ',
'',
' First line of docstring',
' ',
' ',
'',
'',
' .. py:method:: DocstringSig.prop2',
' :module: target',
' :property:',
' ',
'',
' First line of docstring',
' Second line of docstring',
' '
'',
]
# disable autodoc_docstring_signature
@@ -282,41 +282,41 @@ def test_autodoc_docstring_signature(app):
'.. py:class:: DocstringSig',
' :module: target',
'',
' ',
'',
' .. py:method:: DocstringSig.meth()',
' :module: target',
' ',
'',
' meth(FOO, BAR=1) -> BAZ',
' First line of docstring',
' ',
'',
' rest of docstring',
' ',
' ',
' ',
'',
'',
'',
' .. py:method:: DocstringSig.meth2()',
' :module: target',
' ',
'',
' First line, no signature',
' Second line followed by indentation::',
' ',
'',
' indented line',
' ',
' ',
'',
'',
' .. py:method:: DocstringSig.prop1',
' :module: target',
' :property:',
' ',
'',
' DocstringSig.prop1(self)',
' First line of docstring',
' ',
' ',
'',
'',
' .. py:method:: DocstringSig.prop2',
' :module: target',
' :property:',
' ',
'',
' First line of docstring',
' Second line of docstring',
' '
'',
]
@@ -397,13 +397,13 @@ def test_autoclass_content_and_docstring_signature_both(app):
' :module: target.docstring_signature',
'',
' B(foo, bar, baz)',
' ',
'',
'',
'.. py:class:: C(foo, bar)',
' :module: target.docstring_signature',
'',
' C(foo, bar, baz)',
' ',
'',
'',
'.. py:class:: D(foo, bar, baz)',
' :module: target.docstring_signature',
@@ -439,25 +439,25 @@ def test_mocked_module_imports(app, warning):
' :module: target.need_mocks',
'',
' TestAutodoc docstring.',
' ',
' ',
'',
'',
' .. py:method:: TestAutodoc.decoratedMethod()',
' :module: target.need_mocks',
' ',
'',
' TestAutodoc::decoratedMethod docstring',
' ',
'',
'',
'.. py:function:: decoratedFunction()',
' :module: target.need_mocks',
'',
' decoratedFunction docstring',
' ',
'',
'',
'.. py:function:: func(arg: missing_module.Class)',
' :module: target.need_mocks',
'',
' a function takes mocked object as an argument',
' '
'',
]
assert warning.getvalue() == ''
@@ -477,22 +477,22 @@ def test_autodoc_typehints_signature(app):
'.. py:class:: Math(s: str, o: object = None)',
' :module: target.typehints',
'',
' ',
'',
' .. py:method:: Math.decr(a: int, b: int = 1) -> int',
' :module: target.typehints',
' ',
' ',
'',
'',
' .. py:method:: Math.horse(a: str, b: int) -> None',
' :module: target.typehints',
' ',
' ',
'',
'',
' .. py:method:: Math.incr(a: int, b: int = 1) -> int',
' :module: target.typehints',
' ',
' ',
'',
'',
' .. py:method:: Math.nothing() -> None',
' :module: target.typehints',
' ',
'',
'',
'.. py:function:: complex_func(arg1: str, arg2: List[int], arg3: Tuple[int, '
'Union[str, Unknown]] = None, *args: str, **kwargs: str) -> None',
@@ -528,22 +528,22 @@ def test_autodoc_typehints_none(app):
'.. py:class:: Math(s, o=None)',
' :module: target.typehints',
'',
' ',
'',
' .. py:method:: Math.decr(a, b=1)',
' :module: target.typehints',
' ',
' ',
'',
'',
' .. py:method:: Math.horse(a, b)',
' :module: target.typehints',
' ',
' ',
'',
'',
' .. py:method:: Math.incr(a, b=1)',
' :module: target.typehints',
' ',
' ',
'',
'',
' .. py:method:: Math.nothing()',
' :module: target.typehints',
' ',
'',
'',
'.. py:function:: complex_func(arg1, arg2, arg3=None, *args, **kwargs)',
' :module: target.typehints',