You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spiel/tests/utils/test_filter_join.py

22 lines
534 B
Python

from __future__ import annotations
from collections.abc import Iterable
import pytest
from spiel.utils import filter_join
@pytest.mark.parametrize(
"joiner, items, expected",
[
(".", ["a", "b"], "a.b"),
(".", ("a", "b"), "a.b"),
(".", iter(["a", "b"]), "a.b"),
(".", iter(["a", "", "b"]), "a.b"),
(".", iter(["a", None, "b"]), "a.b"),
],
)
def test_filter_join(joiner: str, items: Iterable[str | None], expected: str) -> None:
assert filter_join(joiner, items) == expected