Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
tthijm committed Jun 12, 2024
1 parent 30908b8 commit 18e8104
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,16 @@ def test_is_inside_class():
)
def test_format_dt(dt: datetime.datetime, style: typing.Optional[utils.TimestampStyle], formatted: str):
assert utils.format_dt(dt, style=style) == formatted


@pytest.mark.parametrize(
("parameters", "flattened"),
[
([], ()),
([0, 1, 2], (0, 1, 2)),
([0, typing.Literal["a", 1], "b"], (0, "a", 1, "b")),
([0, "a", typing.Literal[1, typing.Literal["b", 2]], typing.Literal["c"]], (0, "a", 1, "b", 2, "c")),
],
)
def test_flatten_literal_params(parameters: typing.Iterable[typing.Any], flattened: typing.Tuple[typing.Any, ...]) -> None:
assert utils.flatten_literal_params(parameters) == flattened

0 comments on commit 18e8104

Please sign in to comment.