From 5c62e10723d86502e446eb08011b1da9aec2b121 Mon Sep 17 00:00:00 2001 From: Vernon Crabtree Date: Tue, 12 Dec 2023 14:16:57 +0100 Subject: [PATCH] Fix for keywords with no body (such as BREAK) --- Examples.py | 5 +++-- Tests/a test.robot | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Examples.py b/Examples.py index 3f93f30..b7f1d45 100644 --- a/Examples.py +++ b/Examples.py @@ -194,13 +194,14 @@ def _populate_example_to_body(self, body, target): **extra_args) else: new_kw = kw.deepcopy() - new_kw.body = None if hasattr(new_kw, 'values'): new_kw.values = self.replace_list(kw.values) if hasattr(new_kw, 'condition'): new_kw.condition = self.variables.replace_scalar(kw.condition, ignore_errors=True) # TODO: replacement for IF is also necessary - I currently don't have an example of this use-case to test - self._populate_example_to_body(kw.body, new_kw.body) + if hasattr(kw, "body"): + new_kw.body = None + self._populate_example_to_body(kw.body, new_kw.body) target.append(new_kw) def replace_list(self, args): diff --git a/Tests/a test.robot b/Tests/a test.robot index 192e0f7..b007369 100644 --- a/Tests/a test.robot +++ b/Tests/a test.robot @@ -9,3 +9,14 @@ My test with examples for ${name} ... Joe the world! ... Arthur Camelot (clip clop). ... Patsy it's only a model! + +Test of break ${What shall we break} + FOR ${x} IN a b + Log Breaking ${What shall we break} console=True + BREAK + END + + Examples: What shall we break -- + ... Guitar + ... Piano + ... Niels head