mirror of https://github.com/zulip/zulip.git
ruff: Fix E226 Missing whitespace around arithmetic operator.
This is a preview rule, not yet enabled by default. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
d748ec8d52
commit
82a9fd927b
|
@ -268,7 +268,7 @@ def normalize_fixture_data(
|
|||
for i, timestamp_field in enumerate(tested_timestamp_fields):
|
||||
# Don't use (..) notation, since the matched timestamp can easily appear in other fields
|
||||
pattern_translations[f'"{timestamp_field}": 1[5-9][0-9]{{8}}(?![0-9-])'] = (
|
||||
f'"{timestamp_field}": 1{i+1:02}%07d'
|
||||
f'"{timestamp_field}": 1{i + 1:02}%07d'
|
||||
)
|
||||
|
||||
normalized_values: Dict[str, Dict[str, str]] = {pattern: {} for pattern in pattern_translations}
|
||||
|
|
|
@ -49,7 +49,7 @@ def parser() -> argparse.ArgumentParser:
|
|||
"-n",
|
||||
help="Number of log files to search",
|
||||
choices=range(1, access_log_retention_days + 2),
|
||||
metavar=f"[1-{access_log_retention_days+1}]",
|
||||
metavar=f"[1-{access_log_retention_days + 1}]",
|
||||
type=int,
|
||||
)
|
||||
log_selection_options.add_argument(
|
||||
|
@ -503,7 +503,7 @@ def print_line(
|
|||
gap_ms = int((logline_start - last_match_end) / timedelta(milliseconds=1))
|
||||
if gap_ms > 5000:
|
||||
print()
|
||||
print(f"========== {int(gap_ms/1000):>4} second gap ==========")
|
||||
print(f"========== {int(gap_ms / 1000):>4} second gap ==========")
|
||||
print()
|
||||
elif gap_ms > 1000:
|
||||
print(f"============ {gap_ms:>5}ms gap ============")
|
||||
|
|
|
@ -124,7 +124,9 @@ class ValidatorTestCase(ZulipTestCase):
|
|||
to_non_negative_int("x", "-1")
|
||||
with self.assertRaisesRegex(ValueError, re.escape("5 is too large (max 4)")):
|
||||
to_non_negative_int("x", "5", max_int_size=4)
|
||||
with self.assertRaisesRegex(ValueError, re.escape(f"{2**32} is too large (max {2**32-1})")):
|
||||
with self.assertRaisesRegex(
|
||||
ValueError, re.escape(f"{2**32} is too large (max {2**32 - 1})")
|
||||
):
|
||||
to_non_negative_int("x", str(2**32))
|
||||
|
||||
def test_check_float(self) -> None:
|
||||
|
|
|
@ -25,12 +25,12 @@ class Bitbucket2HookTests(WebhookTestCase):
|
|||
|
||||
def test_bitbucket2_on_push_commits_multiple_committers(self) -> None:
|
||||
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))\n"
|
||||
expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 3 commits to branch master. Commits by Ben (2) and Tomasz (1).\n\n{commit_info*2}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
|
||||
expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 3 commits to branch master. Commits by Ben (2) and Tomasz (1).\n\n{commit_info * 2}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
|
||||
self.check_webhook("push_multiple_committers", TOPIC_BRANCH_EVENTS, expected_message)
|
||||
|
||||
def test_bitbucket2_on_push_commits_multiple_committers_with_others(self) -> None:
|
||||
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))\n"
|
||||
expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 10 commits to branch master. Commits by Tomasz (4), James (3), Brendon (2) and others (1).\n\n{commit_info*9}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
|
||||
expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 10 commits to branch master. Commits by Tomasz (4), James (3), Brendon (2) and others (1).\n\n{commit_info * 9}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
|
||||
self.check_webhook(
|
||||
"push_multiple_committers_with_others", TOPIC_BRANCH_EVENTS, expected_message
|
||||
)
|
||||
|
@ -38,7 +38,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
|||
def test_bitbucket2_on_push_commits_multiple_committers_filtered_by_branches(self) -> None:
|
||||
self.url = self.build_webhook_url(branches="master,development")
|
||||
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))\n"
|
||||
expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 3 commits to branch master. Commits by Ben (2) and Tomasz (1).\n\n{commit_info*2}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
|
||||
expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 3 commits to branch master. Commits by Ben (2) and Tomasz (1).\n\n{commit_info * 2}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
|
||||
self.check_webhook("push_multiple_committers", TOPIC_BRANCH_EVENTS, expected_message)
|
||||
|
||||
def test_bitbucket2_on_push_commits_multiple_committers_with_others_filtered_by_branches(
|
||||
|
@ -46,7 +46,7 @@ class Bitbucket2HookTests(WebhookTestCase):
|
|||
) -> None:
|
||||
self.url = self.build_webhook_url(branches="master,development")
|
||||
commit_info = "* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))\n"
|
||||
expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 10 commits to branch master. Commits by Tomasz (4), James (3), Brendon (2) and others (1).\n\n{commit_info*9}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
|
||||
expected_message = f"""Tomasz [pushed](https://bitbucket.org/kolaszek/repository-name/branch/master) 10 commits to branch master. Commits by Tomasz (4), James (3), Brendon (2) and others (1).\n\n{commit_info * 9}* first commit ([84b96adc644](https://bitbucket.org/kolaszek/repository-name/commits/84b96adc644a30fd6465b3d196369d880762afed))"""
|
||||
self.check_webhook(
|
||||
"push_multiple_committers_with_others", TOPIC_BRANCH_EVENTS, expected_message
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue