Skip to content

Commit

Permalink
f-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
pekkaklarck committed Nov 19, 2022
1 parent 2bf64c3 commit fb54dd6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/robot/parsing/lexer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ def _validate(self, orig, name, statement):
message = self._get_non_existing_setting_message(orig, name)
raise ValueError(message)
if self.settings[name] is not None and name not in self.multi_use:
raise ValueError("Setting '%s' is allowed only once. "
"Only the first value is used." % orig)
raise ValueError(f"Setting '{orig}' is allowed only once. "
f"Only the first value is used.")
if name in self.single_value and len(statement) > 2:
raise ValueError("Setting '%s' accepts only one value, got %s."
% (orig, len(statement) - 1))
raise ValueError(f"Setting '{orig}' accepts only one value, "
f"got {len(statement)-1}.")

def _get_non_existing_setting_message(self, name, normalized):
if normalized in (set(TestCaseFileSettings.names) |
Expand All @@ -93,7 +93,7 @@ def _get_non_existing_setting_message(self, name, normalized):
return RecommendationFinder(normalize).find_and_format(
name=normalized,
candidates=tuple(self.settings) + tuple(self.aliases),
message="Non-existing setting '%s'." % name
message=f"Non-existing setting '{name}'."
)

def _lex_error(self, setting, values, error):
Expand Down

0 comments on commit fb54dd6

Please sign in to comment.