mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
Improve string format
This commit is contained in:
@@ -13,9 +13,9 @@ class CannotOverwriteExistingCassetteException(Exception):
|
||||
best_matches = cassette.find_requests_with_most_matches(failed_request)
|
||||
if best_matches:
|
||||
# Build a comprehensible message to put in the exception.
|
||||
best_matches_msg = "Found {} similar requests with {} different matcher(s) :\n".format(
|
||||
len(best_matches),
|
||||
len(best_matches[0][2]),
|
||||
best_matches_msg = (
|
||||
f"Found {len(best_matches)} similar requests "
|
||||
f"with {len(best_matches[0][2])} different matcher(s) :\n"
|
||||
)
|
||||
|
||||
for idx, best_match in enumerate(best_matches, start=1):
|
||||
@@ -30,10 +30,10 @@ class CannotOverwriteExistingCassetteException(Exception):
|
||||
else:
|
||||
best_matches_msg = "No similar requests, that have not been played, found."
|
||||
return (
|
||||
"Can't overwrite existing cassette ({!r}) in "
|
||||
"your current record mode ({!r}).\n"
|
||||
"No match for the request ({!r}) was found.\n"
|
||||
"{}".format(cassette._path, cassette.record_mode, failed_request, best_matches_msg)
|
||||
f"Can't overwrite existing cassette ({cassette._path!r}) in "
|
||||
f"your current record mode ({cassette.record_mode!r}).\n"
|
||||
f"No match for the request ({failed_request!r}) was found.\n"
|
||||
f"{best_matches_msg}"
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user