Skip to content

Commit dbfc3f7

Browse files
committed
Cleanup tests.
Also small enhancements to error messages.
1 parent 95f2f31 commit dbfc3f7

File tree

4 files changed

+205
-258
lines changed

4 files changed

+205
-258
lines changed

robotstatuschecker.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ def _get_error_prefix(
270270
self, parent: "TestCase|BodyItem", locator: "list[str|int]"
271271
) -> str:
272272
typ = getattr(parent, "type", "TEST") # `TestCase.type` is new in RF 7.2.
273-
prefix = f"{typ.title()} '{self._get_name(parent)}'"
273+
if typ in ("TEST", "KEYWORD"):
274+
prefix = f"{typ.title()} '{self._get_name(parent)}'"
275+
else:
276+
prefix = self._get_name(parent)
274277
if locator:
275278
locator_str = ".".join(str(part) for part in locator)
276279
prefix += f" (locator '{locator_str}')"
@@ -290,7 +293,7 @@ def _check_message_by_wildcard(
290293
if len(expected.locator) != level + 1:
291294
raise InvalidUsage(
292295
f"Message index wildcard '*' can be used only as "
293-
f"the last locator item, got '{expected.locator_str}."
296+
f"the last locator item, got '{expected.locator_str}'."
294297
)
295298
if expected.message == "NONE":
296299
raise InvalidUsage(

0 commit comments

Comments
 (0)