Base model for a single keyword. More...
Public Member Functions | |
| def | __bool__ (self) |
| def | __init__ (self, name='', doc='', args=(), assign=(), tags=(), timeout=None, type=BodyItem.KEYWORD, parent=None) |
| def | __str__ (self) |
| def | tags (self, tags) |
Keyword tags as a :class:~.model.tags.Tags object. More... | |
| def | visit (self, visitor) |
:mod:Visitor interface <robot.model.visitor> entry-point. More... | |
Public Member Functions inherited from robot.model.modelobject.ModelObject | |
| def | __repr__ (self) |
| def | config (self, **attributes) |
| Configure model object with given attributes. More... | |
| def | copy (self, **attributes) |
| Return shallow copy of this object. More... | |
| def | deepcopy (self, **attributes) |
| Return deep copy of this object. More... | |
Public Attributes | |
| args | |
| assign | |
| doc | |
| parent | |
| tags | |
| timeout | |
| type | |
Static Public Attributes | |
| tuple | repr_args = ('name', 'args', 'assign') |
Static Public Attributes inherited from robot.model.body.BodyItem | |
| string | BREAK = 'BREAK' |
| string | CONTINUE = 'CONTINUE' |
| string | ELSE = 'ELSE' |
| string | ELSE_IF = 'ELSE IF' |
| string | EXCEPT = 'EXCEPT' |
| string | FINALLY = 'FINALLY' |
| string | FOR = 'FOR' |
| string | IF = 'IF' |
| string | IF_ELSE_ROOT = 'IF/ELSE ROOT' |
| string | ITERATION = 'ITERATION' |
| string | KEYWORD = 'KEYWORD' |
| string | MESSAGE = 'MESSAGE' |
| string | RETURN = 'RETURN' |
| string | SETUP = 'SETUP' |
| string | TEARDOWN = 'TEARDOWN' |
| string | TRY = 'TRY' |
| string | TRY_EXCEPT_ROOT = 'TRY/EXCEPT ROOT' |
| type = None | |
| string | WHILE = 'WHILE' |
Static Public Attributes inherited from robot.model.modelobject.ModelObject | |
| tuple | repr_args = () |
Properties | |
| has_teardown = property | |
| Check does a keyword have a teardown without creating a teardown object. More... | |
| name = property | |
| teardown = property | |
Keyword teardown as a :class:Keyword object. More... | |
Properties inherited from robot.model.body.BodyItem | |
| has_setup = property | |
| has_teardown = property | |
| id = property | |
Item id in format like s1-t3-k1. More... | |
Private Member Functions | |
| def | has_teardown (self) |
| def | name (self) |
| def | name (self, name) |
| def | teardown (self) |
| def | teardown (self, teardown) |
Private Attributes | |
| _name | |
| _teardown | |
Static Private Attributes | |
| list | __slots__ = ['_name', 'doc', 'args', 'assign', 'timeout', 'type', '_teardown'] |
Base model for a single keyword.
Extended by :class:`robot.running.model.Keyword` and :class:`robot.result.model.Keyword`.
Definition at line 32 of file keyword.py.
| def robot.model.keyword.Keyword.__init__ | ( | self, | |
name = '', |
|||
doc = '', |
|||
args = (), |
|||
assign = (), |
|||
tags = (), |
|||
timeout = None, |
|||
type = BodyItem.KEYWORD, |
|||
parent = None |
|||
| ) |
Definition at line 36 of file keyword.py.
| def robot.model.keyword.Keyword.__bool__ | ( | self | ) |
Definition at line 125 of file keyword.py.
| def robot.model.keyword.Keyword.__str__ | ( | self | ) |
Definition at line 128 of file keyword.py.
|
private |
Reimplemented from robot.model.body.BodyItem.
Definition at line 112 of file keyword.py.
|
private |
Reimplemented in robot.result.model.Keyword.
Definition at line 51 of file keyword.py.
|
private |
Reimplemented in robot.result.model.Keyword.
Definition at line 56 of file keyword.py.
| def robot.model.keyword.Keyword.tags | ( | self, | |
| tags | |||
| ) |
Keyword tags as a :class:~.model.tags.Tags object.
Definition at line 117 of file keyword.py.
|
private |
Definition at line 89 of file keyword.py.
|
private |
Definition at line 96 of file keyword.py.
| def robot.model.keyword.Keyword.visit | ( | self, | |
| visitor | |||
| ) |
:mod:Visitor interface <robot.model.visitor> entry-point.
Definition at line 121 of file keyword.py.
|
staticprivate |
Definition at line 34 of file keyword.py.
|
private |
Definition at line 38 of file keyword.py.
|
private |
Definition at line 45 of file keyword.py.
| robot.model.keyword.Keyword.args |
Definition at line 40 of file keyword.py.
| robot.model.keyword.Keyword.assign |
Definition at line 41 of file keyword.py.
| robot.model.keyword.Keyword.doc |
Definition at line 39 of file keyword.py.
| robot.model.keyword.Keyword.parent |
Definition at line 46 of file keyword.py.
Definition at line 33 of file keyword.py.
| robot.model.keyword.Keyword.tags |
Definition at line 42 of file keyword.py.
| robot.model.keyword.Keyword.timeout |
Definition at line 43 of file keyword.py.
| robot.model.keyword.Keyword.type |
Definition at line 44 of file keyword.py.
|
static |
Check does a keyword have a teardown without creating a teardown object.
A difference between using ``if kw.has_teardown:`` and ``if kw.teardown:``
is that accessing the :attr:`teardown` attribute creates a :class:`Keyword`
object representing a teardown even when the keyword actually does not
have one. This typically does not matter, but with bigger suite structures
having lot of keywords it can have a considerable effect on memory usage.
New in Robot Framework 4.1.2.
Definition at line 110 of file keyword.py.
|
static |
Definition at line 49 of file keyword.py.
|
static |
Keyword teardown as a :class:Keyword object.
Teardown can be modified by setting attributes directly::
keyword.teardown.name = 'Example'
keyword.teardown.args = ('First', 'Second')
Alternatively the :meth:`config` method can be used to set multiple
attributes in one call::
keyword.teardown.config(name='Example', args=('First', 'Second'))
The easiest way to reset the whole teardown is setting it to ``None``.
It will automatically recreate the underlying ``Keyword`` object::
keyword.teardown = None
This attribute is a ``Keyword`` object also when a keyword has no teardown
but in that case its truth value is ``False``. If there is a need to just
check does a keyword have a teardown, using the :attr:`has_teardown`
attribute avoids creating the ``Keyword`` object and is thus more memory
efficient.
New in Robot Framework 4.0. Earlier teardown was accessed like
``keyword.keywords.teardown``. :attr:`has_teardown` is new in Robot
Framework 4.1.2.
Definition at line 87 of file keyword.py.