Skip to content

Commit b1f6973

Browse files
committed
Remove more str.format calls caught by newer ruff.
1 parent e8d3373 commit b1f6973

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
args: [--fix, lf]
1717
- id: trailing-whitespace
1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: "v0.0.278"
19+
rev: "v0.0.280"
2020
hooks:
2121
- id: ruff
2222
- repo: https://github.com/PyCQA/isort

jsonschema/tests/test_cli.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,13 @@ def run_cli(
8484

8585
self.assertEqual(
8686
actual_exit_code, exit_code, msg=dedent(
87-
"""
88-
Expected an exit code of {} != {}.
87+
f"""
88+
Expected an exit code of {exit_code} != {actual_exit_code}.
8989
90-
stdout: {}
90+
stdout: {stdout.getvalue()}
9191
92-
stderr: {}
93-
""".format(
94-
exit_code,
95-
actual_exit_code,
96-
stdout.getvalue(),
97-
stderr.getvalue(),
98-
),
92+
stderr: {stderr.getvalue()}
93+
""",
9994
),
10095
)
10196
return stdout.getvalue(), stderr.getvalue()
@@ -450,9 +445,9 @@ def test_instance_is_invalid_JSON(self):
450445
argv=["-i", "some_instance", "some_schema"],
451446

452447
exit_code=1,
453-
stderr="""\
454-
Failed to parse 'some_instance': {}
455-
""".format(_message_for(instance)),
448+
stderr=f"""\
449+
Failed to parse 'some_instance': {_message_for(instance)}
450+
""",
456451
)
457452

458453
def test_instance_is_invalid_JSON_pretty_output(self):
@@ -483,9 +478,9 @@ def test_instance_is_invalid_JSON_on_stdin(self):
483478
argv=["some_schema"],
484479

485480
exit_code=1,
486-
stderr="""\
487-
Failed to parse <stdin>: {}
488-
""".format(_message_for(instance)),
481+
stderr=f"""\
482+
Failed to parse <stdin>: {_message_for(instance)}
483+
""",
489484
)
490485

491486
def test_instance_is_invalid_JSON_on_stdin_pretty_output(self):
@@ -513,9 +508,9 @@ def test_schema_is_invalid_JSON(self):
513508
argv=["some_schema"],
514509

515510
exit_code=1,
516-
stderr="""\
517-
Failed to parse 'some_schema': {}
518-
""".format(_message_for(schema)),
511+
stderr=f"""\
512+
Failed to parse 'some_schema': {_message_for(schema)}
513+
""",
519514
)
520515

521516
def test_schema_is_invalid_JSON_pretty_output(self):
@@ -543,9 +538,9 @@ def test_schema_and_instance_are_both_invalid_JSON(self):
543538
argv=["some_schema"],
544539

545540
exit_code=1,
546-
stderr="""\
547-
Failed to parse 'some_schema': {}
548-
""".format(_message_for(schema)),
541+
stderr=f"""\
542+
Failed to parse 'some_schema': {_message_for(schema)}
543+
""",
549544
)
550545

551546
def test_schema_and_instance_are_both_invalid_JSON_pretty_output(self):

0 commit comments

Comments
 (0)