ruff: Fix RUF007 Prefer `itertools.pairwise()` over `zip()`.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-04-01 15:41:01 -07:00 committed by Tim Abbott
parent 7e2ef11f61
commit ccb95e76dc
1 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import itertools
import json
import operator
import os
@ -4599,11 +4600,11 @@ class BillingHelpersTest(ZulipTestCase):
for i, boundary in enumerate(period_boundaries):
self.assertEqual(add_months(anchor, i), boundary)
# Test next_month for small values
for last, next_ in zip(period_boundaries[:-1], period_boundaries[1:]):
for last, next_ in itertools.pairwise(period_boundaries):
self.assertEqual(next_month(anchor, last), next_)
# Test next_month for large values
period_boundaries = [dt.replace(year=dt.year + 100) for dt in period_boundaries]
for last, next_ in zip(period_boundaries[:-1], period_boundaries[1:]):
for last, next_ in itertools.pairwise(period_boundaries):
self.assertEqual(next_month(anchor, last), next_)
def test_compute_plan_parameters(self) -> None: