1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
from __future__ import annotations
import pytest
import humanize
@pytest.mark.parametrize(
"test_args, expected",
[
([["1", "2", "3"]], "1, 2 and 3"),
([["one", "two", "three"]], "one, two and three"),
([["one", "two"]], "one and two"),
([["one"]], "one"),
([[""]], ""),
([[1, 2, 3]], "1, 2 and 3"),
([[1, "two"]], "1 and two"),
],
)
def test_natural_list(
test_args: list[str] | list[int] | list[str | int], expected: str
) -> None:
assert humanize.natural_list(*test_args) == expected
|