Skip to content

Commit cee827c

Browse files
committed
🏷️ Accept Sequence in CLI output check tests
1 parent ce32ec7 commit cee827c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tests/test_cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
from collections.abc import Sequence
23

34
from typer import Typer
45
from typer.testing import CliRunner
@@ -13,7 +14,7 @@ def __init__(self, app: Typer) -> None:
1314
self.app = app
1415
self.colorstrip = re.compile(r"\x1b\[[0-9;]*m")
1516

16-
def output(self, commands: list[str]) -> list[str]:
17+
def output(self, commands: Sequence[str]) -> list[str]:
1718
"""Invoke the CLI commands and return the output as a list of strings."""
1819
result = super().invoke(self.app, commands, prog_name="zebra")
1920
assert result.exit_code == 0, (
@@ -23,7 +24,9 @@ def output(self, commands: list[str]) -> list[str]:
2324
raise result.exception
2425
return [self.colorstrip.sub("", line) for line in result.output.split("\n")]
2526

26-
def check_output(self, commands: list[str], expected_patterns: list[str]) -> None:
27+
def check_output(
28+
self, commands: Sequence[str], expected_patterns: Sequence[str]
29+
) -> None:
2730
"""Check if the output contains all expected patterns."""
2831
output = self.output(commands)
2932
for pattern in expected_patterns:

0 commit comments

Comments
 (0)