X Tutup
Skip to content

Commit d6310ee

Browse files
committed
Update @Keyword docs related to types
1 parent 86f2ecb commit d6310ee

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/robot/api/deco.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def keyword(name=None, tags=(), types=None):
2323
name, tags, and argument types, respectively.
2424
2525
Name must be given as a string, tags as a list of strings, and types
26-
as a dictionary mapping argument names to types. It is OK to specify
26+
either as a dictionary mapping argument names to types or as a list
27+
of types mapped to arguments based on position. It is OK to specify
2728
only some of these, and when specifying types all arguments do not need
2829
to be typed.
2930
@@ -37,8 +38,12 @@ def login(username, password):
3738
def logout():
3839
# ...
3940
40-
@keyword(types={'first': float, 'third': bool})
41-
def example(first, second, third):
41+
@keyword(types={'length': int, 'case_insensitive': bool})
42+
def types_as_dict(length, case_insensitive=False):
43+
# ...
44+
45+
@keyword(types=[int, bool])
46+
def types_as_list(length, case_insensitive=False):
4247
# ...
4348
4449
tests.robot::

0 commit comments

Comments
 (0)
X Tutup