From bca5564c1ef009266dc2f342576260d3947a454e Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 21 Jul 2023 15:35:07 -0700 Subject: [PATCH] ruff: Fix UP032 Use f-string instead of `format` call. Signed-off-by: Anders Kaseorg --- tools/droplets/create.py | 8 +++----- zerver/webhooks/json/tests.py | 24 +++++++++--------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/tools/droplets/create.py b/tools/droplets/create.py index 58a411d3d8..c9e0427ca4 100644 --- a/tools/droplets/create.py +++ b/tools/droplets/create.py @@ -288,19 +288,17 @@ Your remote Zulip dev server has been created! def print_production_droplet_instructions(droplet_domain_name: str) -> None: print( - """ + f""" ----- Production droplet created successfully! Connect to the server by running -ssh root@{} +ssh root@{droplet_domain_name} ----- -""".format( - droplet_domain_name - ) +""" ) diff --git a/zerver/webhooks/json/tests.py b/zerver/webhooks/json/tests.py index 3f80f8d0b5..fd97dfd8e1 100644 --- a/zerver/webhooks/json/tests.py +++ b/zerver/webhooks/json/tests.py @@ -16,11 +16,9 @@ class JsonHookTests(WebhookTestCase): original_fixture = json.load(f) expected_topic = "JSON" - expected_message = """```json -{original_fixture} -```""".format( - original_fixture=json.dumps(original_fixture, indent=2) - ) + expected_message = f"""```json +{json.dumps(original_fixture, indent=2)} +```""" self.check_webhook("json_github_push__1_commit", expected_topic, expected_message) def test_json_pingdom_http_up_to_down_message(self) -> None: @@ -31,11 +29,9 @@ class JsonHookTests(WebhookTestCase): original_fixture = json.load(f) expected_topic = "JSON" - expected_message = """```json -{original_fixture} -```""".format( - original_fixture=json.dumps(original_fixture, indent=2) - ) + expected_message = f"""```json +{json.dumps(original_fixture, indent=2)} +```""" self.check_webhook("json_pingdom_http_up_to_down", expected_topic, expected_message) def test_json_sentry_event_for_exception_js_message(self) -> None: @@ -46,9 +42,7 @@ class JsonHookTests(WebhookTestCase): original_fixture = json.load(f) expected_topic = "JSON" - expected_message = """```json -{original_fixture} -```""".format( - original_fixture=json.dumps(original_fixture, indent=2) - ) + expected_message = f"""```json +{json.dumps(original_fixture, indent=2)} +```""" self.check_webhook("json_sentry_event_for_exception_js", expected_topic, expected_message)