Coding style.

- Converted to f-strings.
This commit is contained in:
Andrew Hamilton 2018-05-15 16:34:52 +10:00
parent 7cfbcae685
commit e34e896800
11 changed files with 60 additions and 69 deletions

View file

@ -15,7 +15,7 @@ def _accept_actual(failed):
for actual_str, golden_path in failed:
with open(golden_path, "wb") as golden_file:
golden_file.write(actual_str)
print("Wrote golden file: %s" % golden_path)
print("Wrote golden file:", golden_path)
def _show_differences(failed):
@ -52,12 +52,12 @@ def assertGolden(actual, golden_path):
_FAILED.add((actual, golden_path))
if expected is None:
raise unittest.TestCase.failureException(
'The golden file does not exist: %r\nUse "--diff" or'
' "--accept" to create the golden file.' % golden_path)
f'The golden file does not exist: {golden_path!r}\n'
'Use "--diff" or "--accept" to create the golden file.')
else:
raise unittest.TestCase.failureException(
'Output does not match golden file: %r\nUse "--diff" or'
' "--accept" to update the golden file.' % golden_path)
f'Output does not match golden file: {golden_path!r}\n'
'Use "--diff" or "--accept" to update the golden file.')
def main():

View file

@ -258,7 +258,7 @@ def test_against_ls(root_path, environment):
if os.path.exists(path): # Some paths are already gone. e.g. in /proc
color_code = lscolors.color_code_for_path(path, color_codes)
if color_code != ls_color_code:
print("%s %r %r" % (path, color_code, ls_color_code))
print(path, repr(color_code), repr(ls_color_code))
RICH_COLOR_CODES = (