コード例 #1
0
 def _get_runnable_dry_run_keywords(self, args):
     keywords = Body()
     for keyword in self._get_dry_run_keywords(args):
         if contains_variable(keyword.name):
             continue
         keywords.append(keyword)
     return keywords
コード例 #2
0
 def test_no_create(self):
     error = ("'robot.model.Body' object has no attribute 'create'. "
              "Use item specific methods like 'create_keyword' instead.")
     assert_raises_with_msg(AttributeError, error,
                            getattr, Body(), 'create')
     assert_raises_with_msg(AttributeError, error.replace('.model.', '.result.'),
                            getattr, ResultBody(), 'create')
コード例 #3
0
 def test_filter_with_includes_and_excludes_fails(self):
     assert_raises_with_msg(
         ValueError,
         'Items cannot be both included and excluded by type.',
         Body().filter,
         keywords=True,
         ifs=False)
コード例 #4
0
ファイル: test_body.py プロジェクト: vokiput/robotframework
 def test_no_create(self):
     error = ("'Body' object has no attribute 'create'. "
              "Use item specific methods like 'create_keyword' instead.")
     assert_raises_with_msg(AttributeError, error,
                            getattr, Body(), 'create')
     assert_raises_with_msg(AttributeError, error.replace('Body', 'MyBody'),
                            getattr, type('MyBody', (Body,), {})(), 'create')
コード例 #5
0
 def test_filter(self):
     k1, k2, k3 = Keyword(), Keyword(), Keyword()
     f1, i1, i2 = For(), If(), If()
     body = Body(items=[k1, f1, i1, i2, k2, k3])
     assert_equal(body.filter(keywords=True), [k1, k2, k3])
     assert_equal(body.filter(keywords=False), [f1, i1, i2])
     assert_equal(body.filter(ifs=True, fors=True), [f1, i1, i2])
     assert_equal(body.filter(ifs=False, fors=False), [k1, k2, k3])
     assert_equal(body.filter(), [k1, f1, i1, i2, k2, k3])
コード例 #6
0
 def __init__(self, name, args=[]):
     self.name = name
     self.args = FakeArgs(args)
     self.body = Body()
     self.source = None
     self.lineno = -1
     self.return_value = None
     self.doc = Fake()
     self.timeout = Fake()
     self.return_ = Fake()
     self.tags = ()
     self.teardown = None
コード例 #7
0
 def test_filter_with_predicate(self):
     x = Keyword(name='x')
     predicate = lambda item: item.name == 'x'
     body = Body(items=[Keyword(), x, Keyword()])
     assert_equal(body.filter(predicate=predicate), [x])
     body = Body(items=[Keyword(), If(), x, For(), Keyword()])
     assert_equal(body.filter(keywords=True, predicate=predicate), [x])
コード例 #8
0
ファイル: model.py プロジェクト: zahed3795/robotframework
 def body(self, body):
     """Child keywords as a :class:`~.Body` object."""
     return Body(self.__class__, self, body)
コード例 #9
0
 def test_base_body_does_not_support_filtering_by_messages(self):
     error = "'robot.model.Body' object does not support filtering by 'messages'."
     assert_raises_with_msg(TypeError, error,
                            Body().filter, messages=True)
     assert_raises_with_msg(TypeError, error,
                            Body().filter, messages=False)
コード例 #10
0
ファイル: test_body.py プロジェクト: zante95/robotframework
 def test_filter_with_includes_and_excludes_fails(self):
     assert_raises(ValueError, Body().filter, keywords=True, ifs=False)