Skip to content

Commit 10a80b3

Browse files
fix rabbit method name
1 parent 04509d3 commit 10a80b3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/service-library/src/servicelib/rabbitmq/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def routing_key(self) -> str | None:
2424
class RPCNamespacedMethodName(ConstrainedStr):
2525
min_length: int = 1
2626
max_length: int = 255
27-
regex: re.Pattern[str] | None = re.compile(REGEX_RABBIT_QUEUE_ALLOWED_SYMBOLS)
27+
pattern: str = REGEX_RABBIT_QUEUE_ALLOWED_SYMBOLS
2828

2929
@classmethod
3030
def from_namespace_and_method(

packages/service-library/tests/rabbitmq/test_rabbitmq_rpc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,12 @@ async def _a_handler() -> None:
350350
pass
351351

352352
if expect_fail:
353-
with pytest.raises(ValidationError) as exec_info:
353+
with pytest.raises(
354+
ValidationError, match=r"String should have at most \d+ characters"
355+
):
354356
await rpc_server.register_handler(
355357
RPCNamespace("a"), RPCMethodName(handler_name), _a_handler
356358
)
357-
assert "String should have at most 252 characters" in f"{exec_info.value}"
358359
else:
359360
await rpc_server.register_handler(
360361
RPCNamespace("a"), RPCMethodName(handler_name), _a_handler

0 commit comments

Comments
 (0)