Skip to content

Commit 1ccac9f

Browse files
committed
Fix Libdoc init handling if init only has named-only args.
Fixes #4820.
1 parent b15a51d commit 1ccac9f

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

atest/robot/libdoc/python_library.robot

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ Keyword Names
5353

5454
Keyword Arguments
5555
Keyword Arguments Should Be 0
56-
Keyword Arguments Should Be 1 loglevel=None
56+
Keyword Arguments Should Be 1 loglevel=None
5757

5858
Keyword Documentation
59-
Keyword Doc Should Start With 0 Closes all open connections
59+
Keyword Doc Should Start With 0 Closes all open connections
6060
Keyword Doc Should Start With 2
6161
... Executes the given ``command`` and reads, logs, and returns everything until the prompt.
6262
...
@@ -114,6 +114,11 @@ Documentation set in __init__
114114
Run Libdoc And Parse Output ${TESTDATADIR}/DocSetInInit.py
115115
Doc Should Be Doc set in __init__!!
116116

117+
__init__ with only named-only arguments
118+
Run Libdoc And Parse Output ${TESTDATADIR}/InitWithOnlyNamedOnlyArgs.py::b=2
119+
Init Arguments Should Be 0 * a=1 b
120+
Init Doc Should Be 0 xxx
121+
117122
Deprecation
118123
Run Libdoc And Parse Output ${TESTDATADIR}/Deprecation.py
119124
Keyword Name Should Be 0 Deprecated
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class InitWithOnlyNamedOnlyArgs:
2+
3+
def __init__(self, *, a=1, b):
4+
"""xxx"""
5+
6+
def kw(self):
7+
pass

src/robot/libdocpkg/robotbuilder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _get_doc(self, lib):
6161
return lib.doc or f"Documentation for library ``{lib.name}``."
6262

6363
def _get_initializers(self, lib):
64-
if lib.init.arguments.maxargs:
64+
if lib.init.arguments:
6565
return [KeywordDocBuilder().build_keyword(lib.init)]
6666
return []
6767

0 commit comments

Comments
 (0)