Skip to content

Commit 214c688

Browse files
committed
fix <3.10 itertools
1 parent 1400c56 commit 214c688

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/alhambra_mixes/mixes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def emphasize(text: str, tablefmt: str | TableFormat, strong: bool = False) -> s
330330
"""
331331
# formats a title for a table produced using tabulate,
332332
# in the formats tabulate understands
333-
if tablefmt in ["html", "unsafehtml", html_with_borders_tablefmt]:
333+
if tablefmt in ["html", "unsafehtml", html_with_borders_tablefmt]: # type: ignore
334334
if strong:
335335
emph_text = f"<strong>{text}</strong>"
336336
else:
@@ -423,7 +423,7 @@ def _check_names(self, _: str, v: Any) -> None:
423423

424424
def location(
425425
self, tablefmt: str | TableFormat = "pipe", split: bool = True
426-
) -> tuple[list[str], list[int]]:
426+
) -> tuple[str | list[str], list[int]]:
427427
"A formatted string (according to `tablefmt`) for the location of the component/components."
428428
if len(self.wells) == 0:
429429
return f"{self.plate}", []

tests/test_mixes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,18 @@ def test_invalid_wellrefs():
8282
with pytest.raises(ValueError):
8383
WellPos("i123nvalid string")
8484

85+
def _itertools_pairwise(iterable): # FIXME: in 3.10
86+
a, b = itertools.tee(iterable)
87+
next(b, None)
88+
return zip(a, b)
8589

8690
def test_all_wellref_96():
8791
allbyrow96 = [f"{r}{c}" for r in "ABCDEFGH" for c in range(1, 13)]
88-
for x, y in itertools.pairwise(allbyrow96):
92+
for x, y in _itertools_pairwise(allbyrow96):
8993
assert WellPos(x).next_byrow() == y
9094

9195
allbyrow96 = [f"{r}{c}" for c in range(1, 13) for r in "ABCDEFGH"]
92-
for x, y in itertools.pairwise(allbyrow96):
96+
for x, y in _itertools_pairwise(allbyrow96):
9397
assert WellPos(x).next_bycol() == y
9498

9599

0 commit comments

Comments
 (0)