Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cleo._utils coverage #408

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/408.feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved coverage for `cleo._utils` module
8 changes: 8 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from cleo._utils import find_similar_names
from cleo._utils import format_time
from cleo._utils import strip_tags


@pytest.mark.parametrize(
Expand Down Expand Up @@ -39,3 +40,10 @@ def test_format_time(input_secs: float, expected: str) -> None:
def test_find_similar_names(name: str, expected: list[str]) -> None:
names = ["help", "foo1", "foo2", "bar1", "bar2", "foo bar1", "foo bar2"]
assert find_similar_names(name, names) == expected


@pytest.mark.parametrize(
"value, expected", (("<ab> cde</>", " cde"), ("<ab", "<ab"), ("cd>", "cd>"))
)
def test_strip_tags(value: str, expected: str) -> None:
assert strip_tags(value) == expected