Skip to content

Commit

Permalink
Add a test case with args and kwargs without *
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineD committed Sep 18, 2021
1 parent 16e484e commit f1a4eef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion tests/roots/test-ext-autodoc/target/typehints.py
Expand Up @@ -83,10 +83,12 @@ def missing_attr(c,
class _ClassWithDocumentedInit:
"""Class docstring."""

def __init__(self, x: int) -> None:
def __init__(self, x: int, args: int, kwargs: int) -> None:
"""Init docstring.
:param x: Some integer
:param args: Some integer
:param kwargs: Some integer
"""


Expand Down
11 changes: 8 additions & 3 deletions tests/test_ext_autodoc_configs.py
Expand Up @@ -918,16 +918,21 @@ def test_autodoc_typehints_description_with_documented_init_no_undoc(app):
)
app.build()
context = (app.outdir / 'index.txt').read_text()
assert ('class target.typehints._ClassWithDocumentedInit(x)\n'
assert ('class target.typehints._ClassWithDocumentedInit(x, args, kwargs)\n'
'\n'
' Class docstring.\n'
'\n'
' __init__(x)\n'
' __init__(x, args, kwargs)\n'
'\n'
' Init docstring.\n'
'\n'
' Parameters:\n'
' **x** (*int*) -- Some integer\n' == context)
' * **x** (*int*) -- Some integer\n'
'\n'
' * **args** (*int*) -- Some integer\n'
'\n'
' * **kwargs** (*int*) -- Some integer\n'
== context)


@pytest.mark.sphinx('text', testroot='ext-autodoc',
Expand Down

0 comments on commit f1a4eef

Please sign in to comment.