From eab5fa8a68d955022b2799d650d89f90eec23b69 Mon Sep 17 00:00:00 2001 From: Davor Runje Date: Mon, 4 Mar 2024 16:24:29 +0100 Subject: [PATCH] chore: bump package versions --- .secrets.baseline | 4 +- docs/docs/en/release.md | 2 +- faststream/__about__.py | 1 + faststream/__main__.py | 1 + faststream/asyncapi/schema/message.py | 12 ++-- faststream/broker/fastapi/router.py | 18 ++--- faststream/broker/publisher.py | 6 +- faststream/confluent/message.py | 3 +- faststream/kafka/message.py | 3 +- faststream/nats/parser.py | 6 +- pyproject.toml | 10 +-- tests/asyncapi/base/arguments.py | 56 +++++---------- tests/asyncapi/base/fastapi.py | 3 +- tests/asyncapi/base/naming.py | 60 ++++++---------- tests/asyncapi/base/publisher.py | 18 ++--- tests/asyncapi/base/router.py | 6 +- tests/asyncapi/confluent/test_arguments.py | 3 +- tests/asyncapi/confluent/test_naming.py | 3 +- tests/asyncapi/confluent/test_publisher.py | 3 +- tests/asyncapi/confluent/test_router.py | 3 +- tests/asyncapi/kafka/test_arguments.py | 3 +- tests/asyncapi/kafka/test_naming.py | 3 +- tests/asyncapi/kafka/test_publisher.py | 3 +- tests/asyncapi/kafka/test_router.py | 3 +- tests/asyncapi/nats/test_arguments.py | 3 +- tests/asyncapi/nats/test_naming.py | 3 +- tests/asyncapi/nats/test_publisher.py | 3 +- tests/asyncapi/nats/test_router.py | 3 +- tests/asyncapi/rabbit/test_arguments.py | 6 +- tests/asyncapi/rabbit/test_naming.py | 9 +-- tests/asyncapi/rabbit/test_publisher.py | 12 ++-- tests/asyncapi/rabbit/test_router.py | 3 +- tests/asyncapi/redis/test_arguments.py | 15 ++-- tests/asyncapi/redis/test_naming.py | 9 +-- tests/asyncapi/redis/test_publisher.py | 9 +-- tests/asyncapi/redis/test_router.py | 3 +- tests/brokers/base/fastapi.py | 3 +- tests/brokers/confluent/test_fastapi.py | 9 ++- tests/brokers/confluent/test_security.py | 12 ++-- tests/brokers/confluent/test_test_client.py | 12 ++-- tests/brokers/kafka/test_test_client.py | 12 ++-- tests/brokers/nats/test_publish.py | 6 +- tests/brokers/nats/test_test_client.py | 24 +++---- tests/brokers/rabbit/specific/test_declare.py | 3 +- tests/brokers/rabbit/test_test_client.py | 21 ++---- tests/brokers/redis/test_consume.py | 6 +- tests/brokers/redis/test_test_client.py | 12 ++-- .../context/test_existed_context.py | 15 ++-- .../docs/integration/fastapi/test_depends.py | 15 ++-- .../fastapi/test_multiple_lifespan.py | 6 +- tests/docs/integration/fastapi/test_send.py | 15 ++-- .../docs/integration/fastapi/test_startup.py | 15 ++-- tests/docs/kafka/test_security.py | 12 ++-- tests/mypy/kafka.py | 69 +++++++------------ tests/mypy/nats.py | 69 +++++++------------ tests/mypy/rabbit.py | 69 +++++++------------ tests/mypy/redis.py | 69 +++++++------------ tests/utils/context/test_main.py | 3 +- 58 files changed, 273 insertions(+), 515 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index b7d89b9562..7e68fea178 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -128,7 +128,7 @@ "filename": "docs/docs/en/release.md", "hashed_secret": "35675e68f4b5af7b995d9205ad0fc43842f16450", "is_verified": false, - "line_number": 676, + "line_number": 689, "is_secret": false } ], @@ -163,5 +163,5 @@ } ] }, - "generated_at": "2024-02-27T08:00:31Z" + "generated_at": "2024-03-04T15:19:29Z" } diff --git a/docs/docs/en/release.md b/docs/docs/en/release.md index cb8f9d3760..1e4cdc63e0 100644 --- a/docs/docs/en/release.md +++ b/docs/docs/en/release.md @@ -16,7 +16,7 @@ hide: ### What's Changed * Update Release Notes for 0.4.4 by @faststream-release-notes-updater in [#1260](https://github.com/airtai/faststream/pull/1260){.external-link target="_blank"} -* Removed unused pytest dependecy from redis/schemas.py by [@ashambalev](https://github.com/ashambalev){.external-link target="_blank"} in [#1261](https://github.com/airtai/faststream/pull/1261){.external-link target="_blank"} +* Removed unused pytest dependency from redis/schemas.py by [@ashambalev](https://github.com/ashambalev){.external-link target="_blank"} in [#1261](https://github.com/airtai/faststream/pull/1261){.external-link target="_blank"} * chore: bumped package versions by [@davorrunje](https://github.com/davorrunje){.external-link target="_blank"} in [#1270](https://github.com/airtai/faststream/pull/1270){.external-link target="_blank"} * fix (#1263): correct AsyncAPI schema in descriminator case by [@Lancetnik](https://github.com/Lancetnik){.external-link target="_blank"} in [#1272](https://github.com/airtai/faststream/pull/1272){.external-link target="_blank"} diff --git a/faststream/__about__.py b/faststream/__about__.py index 2b278138dd..ca0bf2fdf2 100644 --- a/faststream/__about__.py +++ b/faststream/__about__.py @@ -1,4 +1,5 @@ """Simple and fast framework to create message brokers based microservices.""" + __version__ = "0.4.6" diff --git a/faststream/__main__.py b/faststream/__main__.py index ff57b1eaa4..0778ba8f36 100644 --- a/faststream/__main__.py +++ b/faststream/__main__.py @@ -1,4 +1,5 @@ """CLI entry point to FastStream library.""" + import warnings from faststream.cli.main import cli diff --git a/faststream/asyncapi/schema/message.py b/faststream/asyncapi/schema/message.py index 17bbb68f6e..3c9a09f22e 100644 --- a/faststream/asyncapi/schema/message.py +++ b/faststream/asyncapi/schema/message.py @@ -66,12 +66,12 @@ class Message(BaseModel): # examples # traits - tags: Optional[ - List[Union[Tag, Dict[str, Any]]] - ] = None # TODO: weird TagDict behavior - externalDocs: Optional[ - Union[ExternalDocs, Dict[str, Any]] - ] = None # TODO: weird ExternalDocsDict behavior + tags: Optional[List[Union[Tag, Dict[str, Any]]]] = ( + None # TODO: weird TagDict behavior + ) + externalDocs: Optional[Union[ExternalDocs, Dict[str, Any]]] = ( + None # TODO: weird ExternalDocsDict behavior + ) if PYDANTIC_V2: model_config = {"extra": "allow"} diff --git a/faststream/broker/fastapi/router.py b/faststream/broker/fastapi/router.py index 1ba7ec93f3..efabcc0fdf 100644 --- a/faststream/broker/fastapi/router.py +++ b/faststream/broker/fastapi/router.py @@ -373,29 +373,25 @@ async def start_broker_lifespan( def after_startup( self, func: Callable[[AppType], Mapping[str, Any]], - ) -> Callable[[AppType], Mapping[str, Any]]: - ... + ) -> Callable[[AppType], Mapping[str, Any]]: ... @overload def after_startup( self, func: Callable[[AppType], Awaitable[Mapping[str, Any]]], - ) -> Callable[[AppType], Awaitable[Mapping[str, Any]]]: - ... + ) -> Callable[[AppType], Awaitable[Mapping[str, Any]]]: ... @overload def after_startup( self, func: Callable[[AppType], None], - ) -> Callable[[AppType], None]: - ... + ) -> Callable[[AppType], None]: ... @overload def after_startup( self, func: Callable[[AppType], Awaitable[None]], - ) -> Callable[[AppType], Awaitable[None]]: - ... + ) -> Callable[[AppType], Awaitable[None]]: ... def after_startup( self, @@ -426,15 +422,13 @@ def after_startup( def on_broker_shutdown( self, func: Callable[[AppType], None], - ) -> Callable[[AppType], None]: - ... + ) -> Callable[[AppType], None]: ... @overload def on_broker_shutdown( self, func: Callable[[AppType], Awaitable[None]], - ) -> Callable[[AppType], Awaitable[None]]: - ... + ) -> Callable[[AppType], Awaitable[None]]: ... def on_broker_shutdown( self, diff --git a/faststream/broker/publisher.py b/faststream/broker/publisher.py index 69f1a48c2e..072351cd43 100644 --- a/faststream/broker/publisher.py +++ b/faststream/broker/publisher.py @@ -78,9 +78,9 @@ def __call__( TypeError: If `func` is not callable. """ - handler_call: HandlerCallWrapper[ - MsgType, P_HandlerParams, T_HandlerReturn - ] = HandlerCallWrapper(func) + handler_call: HandlerCallWrapper[MsgType, P_HandlerParams, T_HandlerReturn] = ( + HandlerCallWrapper(func) + ) handler_call._publishers.append(self) self.calls.append(handler_call._original_call) return handler_call diff --git a/faststream/confluent/message.py b/faststream/confluent/message.py index 264d75622d..b3f4850c9e 100644 --- a/faststream/confluent/message.py +++ b/faststream/confluent/message.py @@ -8,8 +8,7 @@ class ConsumerProtocol(Protocol): """A protocol for Kafka consumers.""" - async def commit(self) -> None: - ... + async def commit(self) -> None: ... class FakeConsumer: diff --git a/faststream/kafka/message.py b/faststream/kafka/message.py index 5ad50ee44b..643d7ae2ef 100644 --- a/faststream/kafka/message.py +++ b/faststream/kafka/message.py @@ -8,8 +8,7 @@ class ConsumerProtocol(Protocol): """A protocol for Kafka consumers.""" - async def commit(self) -> None: - ... + async def commit(self) -> None: ... class FakeConsumer: diff --git a/faststream/nats/parser.py b/faststream/nats/parser.py index f62653d4aa..89dbd18bd7 100644 --- a/faststream/nats/parser.py +++ b/faststream/nats/parser.py @@ -27,14 +27,12 @@ def __init__(self, is_js: bool) -> None: @overload async def parse_message( self, message: List[Msg], *, path: Optional[AnyDict] = None - ) -> StreamMessage[List[Msg]]: - ... + ) -> StreamMessage[List[Msg]]: ... @overload async def parse_message( self, message: Msg, *, path: Optional[AnyDict] = None - ) -> StreamMessage[Msg]: - ... + ) -> StreamMessage[Msg]: ... async def parse_message( self, message: Union[Msg, List[Msg]], *, path: Optional[AnyDict] = None diff --git a/pyproject.toml b/pyproject.toml index 488f66a7bc..bae7d3c046 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,11 +85,11 @@ devdocs = [ "mkdocs-material==9.5.11", "mkdocs-static-i18n==1.2.0", "mdx-include==1.4.2", - "mkdocstrings[python]==0.24.0", + "mkdocstrings[python]==0.24.1", "mkdocs-literate-nav==0.6.1", "mkdocs-git-revision-date-localized-plugin==1.2.4", "mike==2.0.0", # versioning - "mkdocs-minify-plugin==0.7.2", + "mkdocs-minify-plugin==0.8.0", "mkdocs-macros-plugin==1.0.5", # includes with variables "mkdocs-glightbox==0.3.7", # img zoom "pillow==10.2.0", @@ -107,13 +107,13 @@ lint = [ "types-docutils", "confluent-kafka-stubs; python_version >= '3.11'", "mypy==1.8.0", - "ruff==0.2.1", + "ruff==0.3.0", "bandit==1.7.7", "semgrep==1.62.0", ] test-core = [ - "coverage[toml]==7.4.1", + "coverage[toml]==7.4.3", "pytest==8.0.1", "pytest-asyncio==0.23.5", "dirty-equals==0.7.1.post0", @@ -128,7 +128,7 @@ testing = [ "httpx==0.27.0", "PyYAML==6.0.1", "watchfiles==0.21.0", - "email-validator==2.1.0.post1", + "email-validator==2.1.1", ] dev = [ diff --git a/tests/asyncapi/base/arguments.py b/tests/asyncapi/base/arguments.py index 516789ef07..642ed24dbf 100644 --- a/tests/asyncapi/base/arguments.py +++ b/tests/asyncapi/base/arguments.py @@ -26,8 +26,7 @@ def test_custom_naming(self): broker = self.broker_class() @broker.subscriber("test", title="custom_name", description="test description") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -54,8 +53,7 @@ def test_no_type(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -69,8 +67,7 @@ def test_simple_type(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg: int): - ... + async def handle(msg: int): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -85,8 +82,7 @@ def test_simple_optional_type(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg: Optional[int]): - ... + async def handle(msg: Optional[int]): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -110,8 +106,7 @@ def test_simple_type_with_default(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg: int = 1): - ... + async def handle(msg: int = 1): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -129,8 +124,7 @@ def test_multi_args_no_type(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg, another): - ... + async def handle(msg, another): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -152,8 +146,7 @@ def test_multi_args_with_type(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg: str, another: int): - ... + async def handle(msg: str, another: int): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -175,8 +168,7 @@ def test_multi_args_with_default(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg: str, another: Optional[int] = None): - ... + async def handle(msg: str, another: Optional[int] = None): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -215,8 +207,7 @@ class User(pydantic.BaseModel): broker = self.broker_class() @broker.subscriber("test") - async def handle(user: User): - ... + async def handle(user: User): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -247,8 +238,7 @@ class User(pydantic.BaseModel): broker = self.broker_class() @broker.subscriber("test") - async def handle(user: User): - ... + async def handle(user: User): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -286,8 +276,7 @@ class User(pydantic.BaseModel): broker = self.broker_class() @broker.subscriber("test") - async def handle(user: User, description: str = ""): - ... + async def handle(user: User, description: str = ""): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -343,8 +332,7 @@ class Config: broker = self.broker_class() @broker.subscriber("test") - async def handle(user: User): - ... + async def handle(user: User): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -374,12 +362,10 @@ class User(pydantic.BaseModel): "test", filter=lambda m: m.content_type == "application/json", ) - async def handle(id: int): - ... + async def handle(id: int): ... @broker.subscriber("test") - async def handle_default(msg): - ... + async def handle_default(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -410,8 +396,7 @@ def dep2(name2: str): message = self.dependency_builder(dep) @broker.subscriber("test", dependencies=dependencies) - async def handle(id: int, message=message): - ... + async def handle(id: int, message=message): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -445,12 +430,11 @@ class Sub(pydantic.BaseModel): broker = self.broker_class() @broker.subscriber("test") - async def handle(user: descriminator): - ... + async def handle(user: descriminator): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() - key = tuple(schema["components"]["messages"].keys())[0] + key = next(schema["components"]["messages"].keys()) assert key == IsStr(regex=r"test[\w:]*:Handle:Message") assert schema["components"] == { "messages": { @@ -498,8 +482,7 @@ async def msg( title="Perfect", examples=[1], ), - ): - ... + ): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -521,8 +504,7 @@ def test_ignores_custom_field(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(id: int, user: Optional[str] = None, message=Context()): - ... + async def handle(id: int, user: Optional[str] = None, message=Context()): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() diff --git a/tests/asyncapi/base/fastapi.py b/tests/asyncapi/base/fastapi.py index 934f6551dd..9ed2d4b3ea 100644 --- a/tests/asyncapi/base/fastapi.py +++ b/tests/asyncapi/base/fastapi.py @@ -73,8 +73,7 @@ async def test_fastapi_asyncapi_routes(self): broker = self.broker_class(schema_url="/asyncapi_schema") @broker.subscriber("test") - async def handler(): - ... + async def handler(): ... app = FastAPI(lifespan=broker.lifespan_context) app.include_router(broker) diff --git a/tests/asyncapi/base/naming.py b/tests/asyncapi/base/naming.py index 34c35dc7e3..96fab98bbf 100644 --- a/tests/asyncapi/base/naming.py +++ b/tests/asyncapi/base/naming.py @@ -17,8 +17,7 @@ def test_subscriber_naming(self): broker = self.broker_class() @broker.subscriber("test") - async def handle_user_created(msg: str): - ... + async def handle_user_created(msg: str): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -38,8 +37,7 @@ def test_pydantic_subscriber_naming(self): broker = self.broker_class() @broker.subscriber("test") - async def handle_user_created(msg: create_model("SimpleModel")): - ... + async def handle_user_created(msg: create_model("SimpleModel")): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -58,8 +56,7 @@ def test_multi_subscribers_naming(self): @broker.subscriber("test") @broker.subscriber("test2") - async def handle_user_created(msg: str): - ... + async def handle_user_created(msg: str): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -81,8 +78,7 @@ def test_subscriber_naming_manual(self): broker = self.broker_class() @broker.subscriber("test", title="custom") - async def handle_user_created(msg: str): - ... + async def handle_user_created(msg: str): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -100,12 +96,10 @@ def test_subscriber_filter_base(self): broker = self.broker_class() @broker.subscriber("test") - async def handle_user_created(msg: str): - ... + async def handle_user_created(msg: str): ... @broker.subscriber("test") - async def handle_user_id(msg: int): - ... + async def handle_user_id(msg: int): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -126,12 +120,10 @@ def test_subscriber_filter_pydantic(self): broker = self.broker_class() @broker.subscriber("test") - async def handle_user_created(msg: create_model("SimpleModel")): - ... + async def handle_user_created(msg: create_model("SimpleModel")): ... @broker.subscriber("test") - async def handle_user_id(msg: int): - ... + async def handle_user_id(msg: int): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -152,12 +144,10 @@ def test_subscriber_filter_with_title(self): broker = self.broker_class() @broker.subscriber("test", title="custom") - async def handle_user_created(msg: str): - ... + async def handle_user_created(msg: str): ... @broker.subscriber("test", title="custom") - async def handle_user_id(msg: int): - ... + async def handle_user_id(msg: int): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -176,8 +166,7 @@ def test_publisher_naming_base(self): broker = self.broker_class() @broker.publisher("test") - async def handle_user_created() -> str: - ... + async def handle_user_created() -> str: ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -195,8 +184,7 @@ def test_publisher_naming_pydantic(self): broker = self.broker_class() @broker.publisher("test") - async def handle_user_created() -> create_model("SimpleModel"): - ... + async def handle_user_created() -> create_model("SimpleModel"): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -214,8 +202,7 @@ def test_publisher_manual_naming(self): broker = self.broker_class() @broker.publisher("test", title="custom") - async def handle_user_created() -> str: - ... + async def handle_user_created() -> str: ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -231,8 +218,7 @@ def test_publisher_with_schema_naming(self): broker = self.broker_class() @broker.publisher("test", schema=str) - async def handle_user_created(): - ... + async def handle_user_created(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -250,8 +236,7 @@ def test_publisher_manual_naming_with_schema(self): broker = self.broker_class() @broker.publisher("test", title="custom", schema=str) - async def handle_user_created(): - ... + async def handle_user_created(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -268,8 +253,7 @@ def test_multi_publishers_naming(self): @broker.publisher("test") @broker.publisher("test2") - async def handle_user_created() -> str: - ... + async def handle_user_created() -> str: ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -294,12 +278,10 @@ def test_multi_publisher_usages(self): pub = broker.publisher("test") @pub - async def handle_user_created() -> str: - ... + async def handle_user_created() -> str: ... @pub - async def handle() -> int: - ... + async def handle() -> int: ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -322,12 +304,10 @@ def test_multi_publisher_usages_with_custom(self): pub = broker.publisher("test", title="custom") @pub - async def handle_user_created() -> str: - ... + async def handle_user_created() -> str: ... @pub - async def handle() -> int: - ... + async def handle() -> int: ... schema = get_app_schema(FastStream(broker)).to_jsonable() diff --git a/tests/asyncapi/base/publisher.py b/tests/asyncapi/base/publisher.py index 9fd693143c..6d069b210c 100644 --- a/tests/asyncapi/base/publisher.py +++ b/tests/asyncapi/base/publisher.py @@ -18,8 +18,7 @@ def test_publisher_with_description(self): broker = self.broker_class() @broker.publisher("test", description="test description") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -30,8 +29,7 @@ def test_basic_publisher(self): broker = self.broker_class() @broker.publisher("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -47,8 +45,7 @@ def test_none_publisher(self): broker = self.broker_class() @broker.publisher("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -60,8 +57,7 @@ def test_typed_publisher(self): broker = self.broker_class() @broker.publisher("test") - async def handle(msg) -> int: - ... + async def handle(msg) -> int: ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -77,8 +73,7 @@ class User(pydantic.BaseModel): broker = self.broker_class() @broker.publisher("test") - async def handle(msg) -> User: - ... + async def handle(msg) -> User: ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -101,8 +96,7 @@ def test_delayed(self): pub = broker.publisher("test") @pub - async def handle(msg) -> int: - ... + async def handle(msg) -> int: ... schema = get_app_schema(self.build_app(broker)).to_jsonable() diff --git a/tests/asyncapi/base/router.py b/tests/asyncapi/base/router.py index 3696871a07..9aa7a72a26 100644 --- a/tests/asyncapi/base/router.py +++ b/tests/asyncapi/base/router.py @@ -14,8 +14,7 @@ class RouterTestcase: # noqa: D101 def test_delay(self): broker = self.broker_class() - async def handle(msg): - ... + async def handle(msg): ... router = self.router_class( handlers=(self.route_class(handle, "test"),), @@ -35,8 +34,7 @@ def test_not_include(self): @router.subscriber("test") @router.publisher("test") - async def handle(msg): - ... + async def handle(msg): ... broker.include_router(router) diff --git a/tests/asyncapi/confluent/test_arguments.py b/tests/asyncapi/confluent/test_arguments.py index 1fb90a75d1..f9bc750920 100644 --- a/tests/asyncapi/confluent/test_arguments.py +++ b/tests/asyncapi/confluent/test_arguments.py @@ -10,8 +10,7 @@ def test_subscriber_bindings(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/confluent/test_naming.py b/tests/asyncapi/confluent/test_naming.py index 423a0121fc..620695d09d 100644 --- a/tests/asyncapi/confluent/test_naming.py +++ b/tests/asyncapi/confluent/test_naming.py @@ -11,8 +11,7 @@ def test_base(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() diff --git a/tests/asyncapi/confluent/test_publisher.py b/tests/asyncapi/confluent/test_publisher.py index 1b8dac5d90..1c6818e36c 100644 --- a/tests/asyncapi/confluent/test_publisher.py +++ b/tests/asyncapi/confluent/test_publisher.py @@ -10,8 +10,7 @@ def test_publisher_bindings(self): broker = self.broker_class() @broker.publisher("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/confluent/test_router.py b/tests/asyncapi/confluent/test_router.py index 5655005e1f..069a313a74 100644 --- a/tests/asyncapi/confluent/test_router.py +++ b/tests/asyncapi/confluent/test_router.py @@ -17,8 +17,7 @@ def test_prefix(self): router = self.router_class(prefix="test_") @router.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... broker.include_router(router) diff --git a/tests/asyncapi/kafka/test_arguments.py b/tests/asyncapi/kafka/test_arguments.py index fbb0bf6b17..8ac03ca99e 100644 --- a/tests/asyncapi/kafka/test_arguments.py +++ b/tests/asyncapi/kafka/test_arguments.py @@ -10,8 +10,7 @@ def test_subscriber_bindings(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/kafka/test_naming.py b/tests/asyncapi/kafka/test_naming.py index b98fc1bc55..f53bad1f65 100644 --- a/tests/asyncapi/kafka/test_naming.py +++ b/tests/asyncapi/kafka/test_naming.py @@ -11,8 +11,7 @@ def test_base(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() diff --git a/tests/asyncapi/kafka/test_publisher.py b/tests/asyncapi/kafka/test_publisher.py index 33c57a4481..13409f7573 100644 --- a/tests/asyncapi/kafka/test_publisher.py +++ b/tests/asyncapi/kafka/test_publisher.py @@ -10,8 +10,7 @@ def test_publisher_bindings(self): broker = self.broker_class() @broker.publisher("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/kafka/test_router.py b/tests/asyncapi/kafka/test_router.py index 8a1bc532a1..2c9b7b75be 100644 --- a/tests/asyncapi/kafka/test_router.py +++ b/tests/asyncapi/kafka/test_router.py @@ -17,8 +17,7 @@ def test_prefix(self): router = self.router_class(prefix="test_") @router.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... broker.include_router(router) diff --git a/tests/asyncapi/nats/test_arguments.py b/tests/asyncapi/nats/test_arguments.py index 09f92284ae..06ad5f8f0a 100644 --- a/tests/asyncapi/nats/test_arguments.py +++ b/tests/asyncapi/nats/test_arguments.py @@ -10,8 +10,7 @@ def test_subscriber_bindings(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/nats/test_naming.py b/tests/asyncapi/nats/test_naming.py index 1b3e9b4156..dee015c606 100644 --- a/tests/asyncapi/nats/test_naming.py +++ b/tests/asyncapi/nats/test_naming.py @@ -11,8 +11,7 @@ def test_base(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() diff --git a/tests/asyncapi/nats/test_publisher.py b/tests/asyncapi/nats/test_publisher.py index e44e20a7d2..f9e259b5e8 100644 --- a/tests/asyncapi/nats/test_publisher.py +++ b/tests/asyncapi/nats/test_publisher.py @@ -10,8 +10,7 @@ def test_publisher_bindings(self): broker = self.broker_class() @broker.publisher("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/nats/test_router.py b/tests/asyncapi/nats/test_router.py index fb2c40d4c0..2f24ec0c77 100644 --- a/tests/asyncapi/nats/test_router.py +++ b/tests/asyncapi/nats/test_router.py @@ -17,8 +17,7 @@ def test_prefix(self): router = self.router_class(prefix="test_") @router.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... broker.include_router(router) diff --git a/tests/asyncapi/rabbit/test_arguments.py b/tests/asyncapi/rabbit/test_arguments.py index 2ea2cbc406..c5b5b237c7 100644 --- a/tests/asyncapi/rabbit/test_arguments.py +++ b/tests/asyncapi/rabbit/test_arguments.py @@ -13,8 +13,7 @@ def test_subscriber_bindings(self): RabbitQueue("test", auto_delete=True), RabbitExchange("test-ex", type=ExchangeType.TOPIC), ) - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -47,8 +46,7 @@ def test_subscriber_fanout_bindings(self): RabbitQueue("test", auto_delete=True), RabbitExchange("test-ex", type=ExchangeType.FANOUT), ) - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/rabbit/test_naming.py b/tests/asyncapi/rabbit/test_naming.py index 4948b0886d..4558210d50 100644 --- a/tests/asyncapi/rabbit/test_naming.py +++ b/tests/asyncapi/rabbit/test_naming.py @@ -13,8 +13,7 @@ def test_subscriber_with_exchange(self): broker = self.broker_class() @broker.subscriber("test", "exchange") - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -28,8 +27,7 @@ def test_publisher_with_exchange(self): broker = self.broker_class() @broker.publisher("test", "exchange") - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -43,8 +41,7 @@ def test_base(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() diff --git a/tests/asyncapi/rabbit/test_publisher.py b/tests/asyncapi/rabbit/test_publisher.py index 92f4e03f5c..e1452cc5c5 100644 --- a/tests/asyncapi/rabbit/test_publisher.py +++ b/tests/asyncapi/rabbit/test_publisher.py @@ -10,8 +10,7 @@ def test_just_exchange(self): broker = self.broker_class("amqp://guest:guest@localhost:5672/vhost") @broker.publisher(exchange="test-ex") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -54,8 +53,7 @@ def test_publisher_bindings(self): RabbitQueue("test", auto_delete=True), RabbitExchange("test-ex", type=ExchangeType.TOPIC), ) - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -88,8 +86,7 @@ def test_useless_queue_bindings(self): RabbitQueue("test", auto_delete=True), RabbitExchange("test-ex", type=ExchangeType.FANOUT), ) - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() @@ -122,8 +119,7 @@ def test_reusable_exchange(self): @broker.publisher(exchange="test-ex", routing_key="key1") @broker.publisher(exchange="test-ex", routing_key="key2", priority=10) - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() diff --git a/tests/asyncapi/rabbit/test_router.py b/tests/asyncapi/rabbit/test_router.py index 145951e4fc..1ba87ddd79 100644 --- a/tests/asyncapi/rabbit/test_router.py +++ b/tests/asyncapi/rabbit/test_router.py @@ -17,8 +17,7 @@ def test_prefix(self): router = self.router_class(prefix="test_") @router.subscriber(RabbitQueue("test", routing_key="key")) - async def handle(msg): - ... + async def handle(msg): ... broker.include_router(router) diff --git a/tests/asyncapi/redis/test_arguments.py b/tests/asyncapi/redis/test_arguments.py index 0c6901f98d..bf1f90258b 100644 --- a/tests/asyncapi/redis/test_arguments.py +++ b/tests/asyncapi/redis/test_arguments.py @@ -10,8 +10,7 @@ def test_channel_subscriber(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -28,8 +27,7 @@ def test_channel_pattern_subscriber(self): broker = self.broker_class() @broker.subscriber("test.{path}") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -46,8 +44,7 @@ def test_list_subscriber(self): broker = self.broker_class() @broker.subscriber(list="test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -60,8 +57,7 @@ def test_stream_subscriber(self): broker = self.broker_class() @broker.subscriber(stream="test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -74,8 +70,7 @@ def test_stream_group_subscriber(self): broker = self.broker_class() @broker.subscriber(stream=StreamSub("test", group="group", consumer="consumer")) - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/redis/test_naming.py b/tests/asyncapi/redis/test_naming.py index ba0e9a9fc3..3b21c5baf4 100644 --- a/tests/asyncapi/redis/test_naming.py +++ b/tests/asyncapi/redis/test_naming.py @@ -13,8 +13,7 @@ def test_base(self): broker = self.broker_class() @broker.subscriber("test") - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)).to_jsonable() @@ -70,8 +69,7 @@ def test_subscribers_variations(self, args): broker = self.broker_class() @broker.subscriber(**args) - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)) assert list(schema.channels.keys()) == ["test:Handle"] @@ -88,8 +86,7 @@ def test_publisher_variations(self, args): broker = self.broker_class() @broker.publisher(**args) - async def handle(): - ... + async def handle(): ... schema = get_app_schema(FastStream(broker)) assert list(schema.channels.keys()) == ["test:Publisher"] diff --git a/tests/asyncapi/redis/test_publisher.py b/tests/asyncapi/redis/test_publisher.py index 65a92d5222..3014476519 100644 --- a/tests/asyncapi/redis/test_publisher.py +++ b/tests/asyncapi/redis/test_publisher.py @@ -10,8 +10,7 @@ def test_channel_publisher(self): broker = self.broker_class() @broker.publisher("test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -28,8 +27,7 @@ def test_list_publisher(self): broker = self.broker_class() @broker.publisher(list="test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 @@ -42,8 +40,7 @@ def test_stream_publisher(self): broker = self.broker_class() @broker.publisher(stream="test") - async def handle(msg): - ... + async def handle(msg): ... schema = get_app_schema(self.build_app(broker)).to_jsonable() key = tuple(schema["channels"].keys())[0] # noqa: RUF015 diff --git a/tests/asyncapi/redis/test_router.py b/tests/asyncapi/redis/test_router.py index b44ec25af8..f68a597e10 100644 --- a/tests/asyncapi/redis/test_router.py +++ b/tests/asyncapi/redis/test_router.py @@ -17,8 +17,7 @@ def test_prefix(self): router = self.router_class(prefix="test_") @router.subscriber("test") - async def handle(msg): - ... + async def handle(msg): ... broker.include_router(router) diff --git a/tests/brokers/base/fastapi.py b/tests/brokers/base/fastapi.py index 0ac7833973..4f40ee9fe7 100644 --- a/tests/brokers/base/fastapi.py +++ b/tests/brokers/base/fastapi.py @@ -201,8 +201,7 @@ async def test_invalid(self, queue: str): app = FastAPI(lifespan=router.lifespan_context) @router.subscriber(queue) - async def hello(msg: int): - ... + async def hello(msg: int): ... app.include_router(router) diff --git a/tests/brokers/confluent/test_fastapi.py b/tests/brokers/confluent/test_fastapi.py index bdd9a34001..d999f2385a 100644 --- a/tests/brokers/confluent/test_fastapi.py +++ b/tests/brokers/confluent/test_fastapi.py @@ -203,8 +203,7 @@ async def test_invalid(self, queue: str): app = FastAPI(lifespan=router.lifespan_context) @router.subscriber(queue, auto_offset_reset="earliest") - async def hello(msg: int): - ... + async def hello(msg: int): ... app.include_router(router) @@ -300,7 +299,11 @@ def mock_dep(): router = self.router_class() - @router.subscriber(queue, auto_offset_reset="earliest", dependencies=(Depends(mock_dep, use_cache=False),)) + @router.subscriber( + queue, + auto_offset_reset="earliest", + dependencies=(Depends(mock_dep, use_cache=False),), + ) async def hello(a): return a diff --git a/tests/brokers/confluent/test_security.py b/tests/brokers/confluent/test_security.py index 72977a2bf3..264c8ac951 100644 --- a/tests/brokers/confluent/test_security.py +++ b/tests/brokers/confluent/test_security.py @@ -35,8 +35,7 @@ async def test_base_security(): from docs.docs_src.confluent.security.basic import broker as basic_broker @basic_broker.subscriber("test") - async def handler(): - ... + async def handler(): ... async with basic_broker: await basic_broker.start() @@ -72,8 +71,7 @@ async def test_scram256(): ) @scram256_broker.subscriber("test") - async def handler(): - ... + async def handler(): ... async with scram256_broker: await scram256_broker.start() @@ -112,8 +110,7 @@ async def test_scram512(): ) @scram512_broker.subscriber("test") - async def handler(): - ... + async def handler(): ... async with scram512_broker: await scram512_broker.start() @@ -152,8 +149,7 @@ async def test_plaintext(): ) @plaintext_broker.subscriber("test") - async def handler(): - ... + async def handler(): ... async with plaintext_broker: await plaintext_broker.start() diff --git a/tests/brokers/confluent/test_test_client.py b/tests/brokers/confluent/test_test_client.py index 71832ab1b7..a60e9d4a56 100644 --- a/tests/brokers/confluent/test_test_client.py +++ b/tests/brokers/confluent/test_test_client.py @@ -88,12 +88,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue, auto_offset_reset="earliest") - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1", auto_offset_reset="earliest") - async def h2(): - ... + async def h2(): ... async with TestKafkaBroker(broker) as br: await br.publish("", queue) @@ -114,12 +112,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue, auto_offset_reset="earliest") - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1", auto_offset_reset="earliest") - async def h2(): - ... + async def h2(): ... async with TestKafkaBroker(broker, with_real=True) as br: await br.publish("", queue) diff --git a/tests/brokers/kafka/test_test_client.py b/tests/brokers/kafka/test_test_client.py index 80f6fee21e..913b5e402a 100644 --- a/tests/brokers/kafka/test_test_client.py +++ b/tests/brokers/kafka/test_test_client.py @@ -86,12 +86,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue) - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1") - async def h2(): - ... + async def h2(): ... async with TestKafkaBroker(broker) as br: await br.publish("", queue) @@ -112,12 +110,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue) - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1") - async def h2(): - ... + async def h2(): ... async with TestKafkaBroker(broker, with_real=True) as br: await br.publish("", queue) diff --git a/tests/brokers/nats/test_publish.py b/tests/brokers/nats/test_publish.py index 027eb1b394..cfe7c74000 100644 --- a/tests/brokers/nats/test_publish.py +++ b/tests/brokers/nats/test_publish.py @@ -14,8 +14,7 @@ async def test_stream_publish( test_broker, ): @test_broker.subscriber(queue, stream="test") - async def m(): - ... + async def m(): ... await test_broker.start() await test_broker.publish("Hi!", queue, stream="test") @@ -28,8 +27,7 @@ async def test_wrong_stream_publish( test_broker, ): @test_broker.subscriber(queue) - async def m(): - ... + async def m(): ... await test_broker.start() await test_broker.publish("Hi!", queue, stream="test") diff --git a/tests/brokers/nats/test_test_client.py b/tests/brokers/nats/test_test_client.py index 9e067a7f50..3894837068 100644 --- a/tests/brokers/nats/test_test_client.py +++ b/tests/brokers/nats/test_test_client.py @@ -43,12 +43,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue) - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1") - async def h2(): - ... + async def h2(): ... async with TestNatsBroker(broker) as br: await br.publish("", queue) @@ -69,12 +67,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue) - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1") - async def h2(): - ... + async def h2(): ... async with TestNatsBroker(broker, with_real=True) as br: await br.publish("", queue) @@ -111,8 +107,7 @@ async def m(): async def test_any_subject_routing(self, test_broker: NatsBroker): @test_broker.subscriber("test.*.subj.*") - def subscriber(): - ... + def subscriber(): ... await test_broker.start() await test_broker.publish("hello", "test.a.subj.b") @@ -120,8 +115,7 @@ def subscriber(): async def test_ending_subject_routing(self, test_broker: NatsBroker): @test_broker.subscriber("test.>") - def subscriber(): - ... + def subscriber(): ... await test_broker.start() await test_broker.publish("hello", "test.a.subj.b") @@ -129,8 +123,7 @@ def subscriber(): async def test_mixed_subject_routing(self, test_broker: NatsBroker): @test_broker.subscriber("*.*.subj.>") - def subscriber(): - ... + def subscriber(): ... await test_broker.start() await test_broker.publish("hello", "test.a.subj.b.c") @@ -143,8 +136,7 @@ async def test_consume_pull( stream: JStream, ): @test_broker.subscriber(queue, stream=stream, pull_sub=PullSub(1)) - def subscriber(m): - ... + def subscriber(m): ... await test_broker.start() await test_broker.publish("hello", queue) diff --git a/tests/brokers/rabbit/specific/test_declare.py b/tests/brokers/rabbit/specific/test_declare.py index a4680523b3..eebf96b31f 100644 --- a/tests/brokers/rabbit/specific/test_declare.py +++ b/tests/brokers/rabbit/specific/test_declare.py @@ -57,8 +57,7 @@ async def test_publisher_declare( broker.declarer = declarer @broker.publisher(queue, queue) - async def f(): - ... + async def f(): ... await broker.start() diff --git a/tests/brokers/rabbit/test_test_client.py b/tests/brokers/rabbit/test_test_client.py index 8e3902e1a2..861d7f0aaa 100644 --- a/tests/brokers/rabbit/test_test_client.py +++ b/tests/brokers/rabbit/test_test_client.py @@ -86,8 +86,7 @@ async def test_any_topic_routing(self, test_broker: RabbitBroker): RabbitQueue("test", routing_key="test.*.subj.*"), exchange=exch, ) - def subscriber(): - ... + def subscriber(): ... await test_broker.start() await test_broker.publish("hello", "test.a.subj.b", exchange=exch) @@ -100,8 +99,7 @@ async def test_ending_topic_routing(self, test_broker: RabbitBroker): RabbitQueue("test", routing_key="test.#"), exchange=exch, ) - def subscriber(): - ... + def subscriber(): ... await test_broker.start() await test_broker.publish("hello", "test.a.subj.b", exchange=exch) @@ -114,8 +112,7 @@ async def test_mixed_topic_routing(self, test_broker: RabbitBroker): RabbitQueue("test", routing_key="*.*.subj.#"), exchange=exch, ) - def subscriber(): - ... + def subscriber(): ... await test_broker.start() await test_broker.publish("hello", "test.a.subj.b.c", exchange=exch) @@ -231,12 +228,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue) - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1") - async def h2(): - ... + async def h2(): ... async with TestRabbitBroker(broker) as br: await br.publish("", queue) @@ -257,12 +252,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue) - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1") - async def h2(): - ... + async def h2(): ... async with TestRabbitBroker(broker, with_real=True) as br: await br.publish("", queue) diff --git a/tests/brokers/redis/test_consume.py b/tests/brokers/redis/test_consume.py index 6227790571..eb33b8151e 100644 --- a/tests/brokers/redis/test_consume.py +++ b/tests/brokers/redis/test_consume.py @@ -232,8 +232,7 @@ async def test_consume_group( full_broker: RedisBroker, ): @full_broker.subscriber(stream=StreamSub(queue, group="group", consumer=queue)) - async def handler(msg: RedisMessage): - ... + async def handler(msg: RedisMessage): ... assert next(iter(full_broker.handlers.values())).last_id == "$" @@ -246,8 +245,7 @@ async def test_consume_group_with_last_id( @full_broker.subscriber( stream=StreamSub(queue, group="group", consumer=queue, last_id="0") ) - async def handler(msg: RedisMessage): - ... + async def handler(msg: RedisMessage): ... assert next(iter(full_broker.handlers.values())).last_id == "0" diff --git a/tests/brokers/redis/test_test_client.py b/tests/brokers/redis/test_test_client.py index 9782ab8191..e46e15df25 100644 --- a/tests/brokers/redis/test_test_client.py +++ b/tests/brokers/redis/test_test_client.py @@ -43,12 +43,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue) - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1") - async def h2(): - ... + async def h2(): ... async with TestRedisBroker(broker) as br: await br.publish("", queue) @@ -69,12 +67,10 @@ async def on_receive(self) -> None: broker.middlewares = (Middleware,) @broker.subscriber(queue) - async def h1(): - ... + async def h1(): ... @broker.subscriber(queue + "1") - async def h2(): - ... + async def h2(): ... async with TestRedisBroker(broker, with_real=True) as br: await br.publish("", queue) diff --git a/tests/docs/getting_started/context/test_existed_context.py b/tests/docs/getting_started/context/test_existed_context.py index 37429d7d55..5b13128849 100644 --- a/tests/docs/getting_started/context/test_existed_context.py +++ b/tests/docs/getting_started/context/test_existed_context.py @@ -14,8 +14,7 @@ async def test_existed_context_kafka(): ) @broker_object.subscriber("response") - async def resp(): - ... + async def resp(): ... async with TestKafkaBroker(broker_object) as br: await br.publish("Hi!", "test-topic") @@ -31,8 +30,7 @@ async def test_existed_context_confluent(): ) @broker_object.subscriber("response") - async def resp(): - ... + async def resp(): ... async with TestConfluentKafkaBroker(broker_object) as br: await br.publish("Hi!", "test-topic") @@ -48,8 +46,7 @@ async def test_existed_context_rabbit(): ) @broker_object.subscriber("response") - async def resp(): - ... + async def resp(): ... async with TestRabbitBroker(broker_object) as br: await br.publish("Hi!", "test-queue") @@ -65,8 +62,7 @@ async def test_existed_context_nats(): ) @broker_object.subscriber("response") - async def resp(): - ... + async def resp(): ... async with TestNatsBroker(broker_object) as br: await br.publish("Hi!", "test-subject") @@ -82,8 +78,7 @@ async def test_existed_context_redis(): ) @broker_object.subscriber("response") - async def resp(): - ... + async def resp(): ... async with TestRedisBroker(broker_object) as br: await br.publish("Hi!", "test-channel") diff --git a/tests/docs/integration/fastapi/test_depends.py b/tests/docs/integration/fastapi/test_depends.py index 24e3064326..ae160bb622 100644 --- a/tests/docs/integration/fastapi/test_depends.py +++ b/tests/docs/integration/fastapi/test_depends.py @@ -13,8 +13,7 @@ async def test_fastapi_kafka_depends(): from docs.docs_src.integrations.fastapi.kafka.depends import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestKafkaBroker(router.broker): with TestClient(app) as client: @@ -28,8 +27,7 @@ async def test_fastapi_confluent_depends(): from docs.docs_src.integrations.fastapi.confluent.depends import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestConfluentKafkaBroker(router.broker): with TestClient(app) as client: @@ -43,8 +41,7 @@ async def test_fastapi_rabbit_depends(): from docs.docs_src.integrations.fastapi.rabbit.depends import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestRabbitBroker(router.broker): with TestClient(app) as client: @@ -58,8 +55,7 @@ async def test_fastapi_nats_depends(): from docs.docs_src.integrations.fastapi.nats.depends import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestNatsBroker(router.broker): with TestClient(app) as client: @@ -73,8 +69,7 @@ async def test_fastapi_redis_depends(): from docs.docs_src.integrations.fastapi.redis.depends import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestRedisBroker(router.broker): with TestClient(app) as client: diff --git a/tests/docs/integration/fastapi/test_multiple_lifespan.py b/tests/docs/integration/fastapi/test_multiple_lifespan.py index b34bad88f7..d222ba5e78 100644 --- a/tests/docs/integration/fastapi/test_multiple_lifespan.py +++ b/tests/docs/integration/fastapi/test_multiple_lifespan.py @@ -7,12 +7,10 @@ def test_running(self, data): app, core_router, nested_router = data @core_router.subscriber("test1") - async def handler(): - ... + async def handler(): ... @nested_router.subscriber("test2") - async def handler2(): - ... + async def handler2(): ... handlers1 = core_router.broker.handlers.values() handlers2 = nested_router.broker.handlers.values() diff --git a/tests/docs/integration/fastapi/test_send.py b/tests/docs/integration/fastapi/test_send.py index abfa7f5b1b..b8f1fca7d8 100644 --- a/tests/docs/integration/fastapi/test_send.py +++ b/tests/docs/integration/fastapi/test_send.py @@ -13,8 +13,7 @@ async def test_fastapi_kafka_send(): from docs.docs_src.integrations.fastapi.kafka.send import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestKafkaBroker(router.broker): with TestClient(app) as client: @@ -28,8 +27,7 @@ async def test_fastapi_confluent_send(): from docs.docs_src.integrations.fastapi.confluent.send import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestConfluentKafkaBroker(router.broker): with TestClient(app) as client: @@ -43,8 +41,7 @@ async def test_fastapi_rabbit_send(): from docs.docs_src.integrations.fastapi.rabbit.send import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestRabbitBroker(router.broker): with TestClient(app) as client: @@ -58,8 +55,7 @@ async def test_fastapi_nats_send(): from docs.docs_src.integrations.fastapi.nats.send import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestNatsBroker(router.broker): with TestClient(app) as client: @@ -73,8 +69,7 @@ async def test_fastapi_redis_send(): from docs.docs_src.integrations.fastapi.redis.send import app, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestRedisBroker(router.broker): with TestClient(app) as client: diff --git a/tests/docs/integration/fastapi/test_startup.py b/tests/docs/integration/fastapi/test_startup.py index a9078f5f83..d4e80b8851 100644 --- a/tests/docs/integration/fastapi/test_startup.py +++ b/tests/docs/integration/fastapi/test_startup.py @@ -13,8 +13,7 @@ async def test_fastapi_kafka_startup(): from docs.docs_src.integrations.fastapi.kafka.startup import app, hello, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestKafkaBroker(router.broker): with TestClient(app): @@ -26,8 +25,7 @@ async def test_fastapi_confluent_startup(): from docs.docs_src.integrations.fastapi.confluent.startup import app, hello, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestConfluentKafkaBroker(router.broker): with TestClient(app): @@ -39,8 +37,7 @@ async def test_fastapi_rabbit_startup(): from docs.docs_src.integrations.fastapi.rabbit.startup import app, hello, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestRabbitBroker(router.broker): with TestClient(app): @@ -52,8 +49,7 @@ async def test_fastapi_nats_startup(): from docs.docs_src.integrations.fastapi.nats.startup import app, hello, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestNatsBroker(router.broker): with TestClient(app): @@ -65,8 +61,7 @@ async def test_fastapi_redis_startup(): from docs.docs_src.integrations.fastapi.redis.startup import app, hello, router @router.subscriber("test") - async def handler(): - ... + async def handler(): ... async with TestRedisBroker(router.broker): with TestClient(app): diff --git a/tests/docs/kafka/test_security.py b/tests/docs/kafka/test_security.py index ff5ed6989d..9b4bf5ac06 100644 --- a/tests/docs/kafka/test_security.py +++ b/tests/docs/kafka/test_security.py @@ -31,8 +31,7 @@ async def test_base_security(): from docs.docs_src.kafka.security.basic import broker as basic_broker @basic_broker.subscriber("test") - async def handler(): - ... + async def handler(): ... async with basic_broker: await basic_broker.start() @@ -59,8 +58,7 @@ async def test_scram256(): ) @scram256_broker.subscriber("test") - async def handler(): - ... + async def handler(): ... async with scram256_broker: await scram256_broker.start() @@ -90,8 +88,7 @@ async def test_scram512(): ) @scram512_broker.subscriber("test") - async def handler(): - ... + async def handler(): ... async with scram512_broker: await scram512_broker.start() @@ -121,8 +118,7 @@ async def test_plaintext(): ) @plaintext_broker.subscriber("test") - async def handler(): - ... + async def handler(): ... async with plaintext_broker: await plaintext_broker.start() diff --git a/tests/mypy/kafka.py b/tests/mypy/kafka.py index f98313de8e..47fcbddf2d 100644 --- a/tests/mypy/kafka.py +++ b/tests/mypy/kafka.py @@ -60,16 +60,14 @@ async def async_filter(msg: KafkaMessage) -> bool: "test", filter=sync_filter, ) -async def handle() -> None: - ... +async def handle() -> None: ... @broker.subscriber( "test", filter=async_filter, ) -async def handle2() -> None: - ... +async def handle2() -> None: ... @broker.subscriber( @@ -77,8 +75,7 @@ async def handle2() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle3() -> None: - ... +async def handle3() -> None: ... @broker.subscriber( @@ -86,8 +83,7 @@ async def handle3() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle4() -> None: - ... +async def handle4() -> None: ... @broker.subscriber( @@ -95,20 +91,17 @@ async def handle4() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle5() -> None: - ... +async def handle5() -> None: ... @broker.subscriber("test") @broker.publisher("test2") -def handle6() -> None: - ... +def handle6() -> None: ... @broker.subscriber("test") @broker.publisher("test2") -async def handle7() -> None: - ... +async def handle7() -> None: ... KafkaRouter( @@ -131,16 +124,14 @@ async def handle7() -> None: "test", filter=sync_filter, ) -async def handle8() -> None: - ... +async def handle8() -> None: ... @router.subscriber( "test", filter=async_filter, ) -async def handle9() -> None: - ... +async def handle9() -> None: ... @router.subscriber( @@ -148,8 +139,7 @@ async def handle9() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle10() -> None: - ... +async def handle10() -> None: ... @router.subscriber( @@ -157,8 +147,7 @@ async def handle10() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle11() -> None: - ... +async def handle11() -> None: ... @router.subscriber( @@ -166,28 +155,23 @@ async def handle11() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle12() -> None: - ... +async def handle12() -> None: ... @router.subscriber("test") @router.publisher("test2") -def handle13() -> None: - ... +def handle13() -> None: ... @router.subscriber("test") @router.publisher("test2") -async def handle14() -> None: - ... +async def handle14() -> None: ... -def sync_handler() -> None: - ... +def sync_handler() -> None: ... -def async_handler() -> None: - ... +def async_handler() -> None: ... KafkaRouter( @@ -236,16 +220,14 @@ def async_handler() -> None: "test", filter=sync_filter, ) -async def handle15() -> None: - ... +async def handle15() -> None: ... @fastapi_router.subscriber( "test", filter=async_filter, ) -async def handle16() -> None: - ... +async def handle16() -> None: ... @fastapi_router.subscriber( @@ -253,8 +235,7 @@ async def handle16() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle17() -> None: - ... +async def handle17() -> None: ... @fastapi_router.subscriber( @@ -262,8 +243,7 @@ async def handle17() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle18() -> None: - ... +async def handle18() -> None: ... @fastapi_router.subscriber( @@ -271,17 +251,14 @@ async def handle18() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle19() -> None: - ... +async def handle19() -> None: ... @fastapi_router.subscriber("test") @fastapi_router.publisher("test2") -def handle20() -> None: - ... +def handle20() -> None: ... @fastapi_router.subscriber("test") @fastapi_router.publisher("test2") -async def handle21() -> None: - ... +async def handle21() -> None: ... diff --git a/tests/mypy/nats.py b/tests/mypy/nats.py index 6ec62edcf4..2df03803d7 100644 --- a/tests/mypy/nats.py +++ b/tests/mypy/nats.py @@ -60,16 +60,14 @@ async def async_filter(msg: NatsMessage) -> bool: "test", filter=sync_filter, ) -async def handle() -> None: - ... +async def handle() -> None: ... @broker.subscriber( "test", filter=async_filter, ) -async def handle2() -> None: - ... +async def handle2() -> None: ... @broker.subscriber( @@ -77,8 +75,7 @@ async def handle2() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle3() -> None: - ... +async def handle3() -> None: ... @broker.subscriber( @@ -86,8 +83,7 @@ async def handle3() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle4() -> None: - ... +async def handle4() -> None: ... @broker.subscriber( @@ -95,20 +91,17 @@ async def handle4() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle5() -> None: - ... +async def handle5() -> None: ... @broker.subscriber("test") @broker.publisher("test2") -def handle6() -> None: - ... +def handle6() -> None: ... @broker.subscriber("test") @broker.publisher("test2") -async def handle7() -> None: - ... +async def handle7() -> None: ... NatsRouter( @@ -131,16 +124,14 @@ async def handle7() -> None: "test", filter=sync_filter, ) -async def handle8() -> None: - ... +async def handle8() -> None: ... @router.subscriber( "test", filter=async_filter, ) -async def handle9() -> None: - ... +async def handle9() -> None: ... @router.subscriber( @@ -148,8 +139,7 @@ async def handle9() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle10() -> None: - ... +async def handle10() -> None: ... @router.subscriber( @@ -157,8 +147,7 @@ async def handle10() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle11() -> None: - ... +async def handle11() -> None: ... @router.subscriber( @@ -166,28 +155,23 @@ async def handle11() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle12() -> None: - ... +async def handle12() -> None: ... @router.subscriber("test") @router.publisher("test2") -def handle13() -> None: - ... +def handle13() -> None: ... @router.subscriber("test") @router.publisher("test2") -async def handle14() -> None: - ... +async def handle14() -> None: ... -def sync_handler() -> None: - ... +def sync_handler() -> None: ... -def async_handler() -> None: - ... +def async_handler() -> None: ... NatsRouter( @@ -236,16 +220,14 @@ def async_handler() -> None: "test", filter=sync_filter, ) -async def handle15() -> None: - ... +async def handle15() -> None: ... @fastapi_router.subscriber( "test", filter=async_filter, ) -async def handle16() -> None: - ... +async def handle16() -> None: ... @fastapi_router.subscriber( @@ -253,8 +235,7 @@ async def handle16() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle17() -> None: - ... +async def handle17() -> None: ... @fastapi_router.subscriber( @@ -262,8 +243,7 @@ async def handle17() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle18() -> None: - ... +async def handle18() -> None: ... @fastapi_router.subscriber( @@ -271,17 +251,14 @@ async def handle18() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle19() -> None: - ... +async def handle19() -> None: ... @fastapi_router.subscriber("test") @fastapi_router.publisher("test2") -def handle20() -> None: - ... +def handle20() -> None: ... @fastapi_router.subscriber("test") @fastapi_router.publisher("test2") -async def handle21() -> None: - ... +async def handle21() -> None: ... diff --git a/tests/mypy/rabbit.py b/tests/mypy/rabbit.py index 31ff9a8a6e..2bc2be77e1 100644 --- a/tests/mypy/rabbit.py +++ b/tests/mypy/rabbit.py @@ -61,16 +61,14 @@ async def async_filter(msg: RabbitMessage) -> bool: "test", filter=sync_filter, ) -async def handle() -> None: - ... +async def handle() -> None: ... @broker.subscriber( "test", filter=async_filter, ) -async def handle2() -> None: - ... +async def handle2() -> None: ... @broker.subscriber( @@ -78,8 +76,7 @@ async def handle2() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle3() -> None: - ... +async def handle3() -> None: ... @broker.subscriber( @@ -87,8 +84,7 @@ async def handle3() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle4() -> None: - ... +async def handle4() -> None: ... @broker.subscriber( @@ -96,20 +92,17 @@ async def handle4() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle5() -> None: - ... +async def handle5() -> None: ... @broker.subscriber("test") @broker.publisher("test2") -def handle6() -> None: - ... +def handle6() -> None: ... @broker.subscriber("test") @broker.publisher("test2") -async def handle7() -> None: - ... +async def handle7() -> None: ... RabbitRouter( @@ -132,16 +125,14 @@ async def handle7() -> None: "test", filter=sync_filter, ) -async def handle8() -> None: - ... +async def handle8() -> None: ... @router.subscriber( "test", filter=async_filter, ) -async def handle9() -> None: - ... +async def handle9() -> None: ... @router.subscriber( @@ -149,8 +140,7 @@ async def handle9() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle10() -> None: - ... +async def handle10() -> None: ... @router.subscriber( @@ -158,8 +148,7 @@ async def handle10() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle11() -> None: - ... +async def handle11() -> None: ... @router.subscriber( @@ -167,28 +156,23 @@ async def handle11() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle12() -> None: - ... +async def handle12() -> None: ... @router.subscriber("test") @router.publisher("test2") -def handle13() -> None: - ... +def handle13() -> None: ... @router.subscriber("test") @router.publisher("test2") -async def handle14() -> None: - ... +async def handle14() -> None: ... -def sync_handler() -> None: - ... +def sync_handler() -> None: ... -def async_handler() -> None: - ... +def async_handler() -> None: ... RabbitRouter( @@ -237,16 +221,14 @@ def async_handler() -> None: "test", filter=sync_filter, ) -async def handle15() -> None: - ... +async def handle15() -> None: ... @fastapi_router.subscriber( "test", filter=async_filter, ) -async def handle16() -> None: - ... +async def handle16() -> None: ... @fastapi_router.subscriber( @@ -254,8 +236,7 @@ async def handle16() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle17() -> None: - ... +async def handle17() -> None: ... @fastapi_router.subscriber( @@ -263,8 +244,7 @@ async def handle17() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle18() -> None: - ... +async def handle18() -> None: ... @fastapi_router.subscriber( @@ -272,17 +252,14 @@ async def handle18() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle19() -> None: - ... +async def handle19() -> None: ... @fastapi_router.subscriber("test") @fastapi_router.publisher("test2") -def handle20() -> None: - ... +def handle20() -> None: ... @fastapi_router.subscriber("test") @fastapi_router.publisher("test2") -async def handle21() -> None: - ... +async def handle21() -> None: ... diff --git a/tests/mypy/redis.py b/tests/mypy/redis.py index fd0ab4ca26..08facdecc4 100644 --- a/tests/mypy/redis.py +++ b/tests/mypy/redis.py @@ -62,16 +62,14 @@ async def async_filter(msg: Message) -> bool: "test", filter=sync_filter, ) -async def handle() -> None: - ... +async def handle() -> None: ... @broker.subscriber( "test", filter=async_filter, ) -async def handle2() -> None: - ... +async def handle2() -> None: ... @broker.subscriber( @@ -79,8 +77,7 @@ async def handle2() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle3() -> None: - ... +async def handle3() -> None: ... @broker.subscriber( @@ -88,8 +85,7 @@ async def handle3() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle4() -> None: - ... +async def handle4() -> None: ... @broker.subscriber( @@ -97,20 +93,17 @@ async def handle4() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle5() -> None: - ... +async def handle5() -> None: ... @broker.subscriber("test") @broker.publisher("test2") -def handle6() -> None: - ... +def handle6() -> None: ... @broker.subscriber("test") @broker.publisher("test2") -async def handle7() -> None: - ... +async def handle7() -> None: ... StreamRouter( @@ -134,16 +127,14 @@ async def handle7() -> None: "test", filter=sync_filter, ) -async def handle8() -> None: - ... +async def handle8() -> None: ... @router.subscriber( "test", filter=async_filter, ) -async def handle9() -> None: - ... +async def handle9() -> None: ... @router.subscriber( @@ -151,8 +142,7 @@ async def handle9() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle10() -> None: - ... +async def handle10() -> None: ... @router.subscriber( @@ -160,8 +150,7 @@ async def handle10() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle11() -> None: - ... +async def handle11() -> None: ... @router.subscriber( @@ -169,28 +158,23 @@ async def handle11() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle12() -> None: - ... +async def handle12() -> None: ... @router.subscriber("test") @router.publisher("test2") -def handle13() -> None: - ... +def handle13() -> None: ... @router.subscriber("test") @router.publisher("test2") -async def handle14() -> None: - ... +async def handle14() -> None: ... -def sync_handler() -> None: - ... +def sync_handler() -> None: ... -def async_handler() -> None: - ... +def async_handler() -> None: ... StreamRouter( @@ -239,16 +223,14 @@ def async_handler() -> None: "test", filter=sync_filter, ) -async def handle15() -> None: - ... +async def handle15() -> None: ... @fastapi_router.subscriber( "test", filter=async_filter, ) -async def handle16() -> None: - ... +async def handle16() -> None: ... @fastapi_router.subscriber( @@ -256,8 +238,7 @@ async def handle16() -> None: parser=sync_parser, decoder=sync_decoder, ) -async def handle17() -> None: - ... +async def handle17() -> None: ... @fastapi_router.subscriber( @@ -265,8 +246,7 @@ async def handle17() -> None: parser=async_parser, decoder=async_decoder, ) -async def handle18() -> None: - ... +async def handle18() -> None: ... @fastapi_router.subscriber( @@ -274,17 +254,14 @@ async def handle18() -> None: parser=custom_parser, decoder=custom_decoder, ) -async def handle19() -> None: - ... +async def handle19() -> None: ... @fastapi_router.subscriber("test") @fastapi_router.publisher("test2") -def handle20() -> None: - ... +def handle20() -> None: ... @fastapi_router.subscriber("test") @fastapi_router.publisher("test2") -async def handle21() -> None: - ... +async def handle21() -> None: ... diff --git a/tests/utils/context/test_main.py b/tests/utils/context/test_main.py index 98d96a977e..35b75f7afe 100644 --- a/tests/utils/context/test_main.py +++ b/tests/utils/context/test_main.py @@ -101,8 +101,7 @@ async def test_reset_global(context: ContextRepo): context.reset_global("key") @apply_types - async def use(key=Context()): - ... + async def use(key=Context()): ... with pytest.raises(ValidationError): await use()