-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtest_resolve_message.py
More file actions
32 lines (28 loc) · 1023 Bytes
/
test_resolve_message.py
File metadata and controls
32 lines (28 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import typing
import pytest
from faststream.types import SendableMessage
from taskiq_faststream.utils import resolve_msg
from tests import messages
@pytest.mark.parametrize(
"msg",
[
messages.message, # regular msg
messages.sync_callable_msg, # sync callable
messages.async_callable_msg, # async callable
messages.sync_generator_msg, # sync generator
messages.async_generator_msg, # async generator
messages.sync_callable_class_message, # sync callable class
messages.async_callable_class_message, # async callable class
],
)
@pytest.mark.anyio
async def test_resolve_msg(
msg: None
| SendableMessage
| typing.Callable[[], SendableMessage]
| typing.Callable[[], typing.Awaitable[SendableMessage]]
| typing.Callable[[], typing.Generator[SendableMessage, None, None]]
| typing.Callable[[], typing.AsyncGenerator[SendableMessage, None]],
) -> None:
async for m in resolve_msg(msg):
assert m == messages.message