diff --git a/moto/polly/models.py b/moto/polly/models.py index d97399358..d28abd409 100644 --- a/moto/polly/models.py +++ b/moto/polly/models.py @@ -42,7 +42,7 @@ class Lexicon(BaseModel): self.language_code = value except Exception as err: - raise ValueError("Failure parsing XML: {0}".format(err)) + raise ValueError(f"Failure parsing XML: {err}") def to_dict(self): return { @@ -57,7 +57,7 @@ class Lexicon(BaseModel): } def __repr__(self): - return "".format(self.name) + return f"" class PollyBackend(BaseBackend): diff --git a/moto/polly/responses.py b/moto/polly/responses.py index f0f7d8b77..6b4532ac3 100644 --- a/moto/polly/responses.py +++ b/moto/polly/responses.py @@ -39,11 +39,10 @@ class PollyResponse(BaseResponse): language_code = self._get_param("LanguageCode") if language_code is not None and language_code not in LANGUAGE_CODES: + all_codes = ", ".join(LANGUAGE_CODES) msg = ( - "1 validation error detected: Value '{0}' at 'languageCode' failed to satisfy constraint: " - "Member must satisfy enum value set: [{1}]".format( - language_code, ", ".join(LANGUAGE_CODES) - ) + f"1 validation error detected: Value '{language_code}' at 'languageCode' failed to satisfy constraint: " + f"Member must satisfy enum value set: [{all_codes}]" ) return msg, dict(status=400) @@ -170,9 +169,8 @@ class PollyResponse(BaseResponse): if "VoiceId" not in self.json: return self._error("MissingParameter", "Missing parameter VoiceId") if self.json["VoiceId"] not in VOICE_IDS: - return self._error( - "InvalidParameterValue", "Not one of {0}".format(", ".join(VOICE_IDS)) - ) + all_voices = ", ".join(VOICE_IDS) + return self._error("InvalidParameterValue", f"Not one of {all_voices}") args["voice_id"] = self.json["VoiceId"] # More validation diff --git a/moto/polly/utils.py b/moto/polly/utils.py index c13404109..a0de8713a 100644 --- a/moto/polly/utils.py +++ b/moto/polly/utils.py @@ -1,2 +1,2 @@ def make_arn_for_lexicon(account_id, name, region_name): - return "arn:aws:polly:{0}:{1}:lexicon/{2}".format(region_name, account_id, name) + return f"arn:aws:polly:{region_name}:{account_id}:lexicon/{name}"