Coverage for docs/docs_src/getting_started/routers/redis/delay_equal.py: 69%

13 statements  

« prev     ^ index     » next       coverage.py v7.17.3, created at 2026-11-17 21:20 +0000

1from faststream import FastStream 

2from faststream.redis import RedisBroker 

3from faststream.redis import RedisRouter, RedisRoute, RedisPublisher 

4 

5broker = RedisBroker("redis://localhost:6379") 

6app = FastStream(broker) 

7 

8router = RedisRouter() 

9 

10@router.subscriber("test-channel") 

11@router.publisher("outer-channel") 

12async def handle(name: str, user_id: int): 

13 assert name == "John" 

14 assert user_id == 1 

15 return "Hi!" 

16 

17broker.include_router(router) 

18 

19@app.after_startup 

20async def test(): 

21 await broker.publish({"name": "John", "user_id": 1}, channel="test-channel")