Coverage for faststream/rabbit/helpers/state.py: 82%
11 statements
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-17 21:20 +0000
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-17 21:20 +0000
1from dataclasses import dataclass
2from typing import TYPE_CHECKING, Protocol
4from faststream.exceptions import IncorrectState
6if TYPE_CHECKING:
7 from aio_pika import RobustConnection
10class ConnectionState(Protocol):
11 __slots__ = ()
13 @property
14 def connection(self) -> "RobustConnection": ...
17class EmptyConnectionState:
18 __slots__ = ()
20 @property
21 def connection(self) -> "RobustConnection":
22 msg = "You should connect broker first."
23 raise IncorrectState(msg)
26@dataclass(slots=True)
27class ConnectedState:
28 connection: "RobustConnection"