From 2d4e7db96278d926a5d53bb7e4974853fb12c306 Mon Sep 17 00:00:00 2001 From: Mikhail Bulash Date: Thu, 24 Apr 2025 18:54:11 +0200 Subject: [PATCH] fixup! Public interface, docs and a test --- alembic/config.py | 9 +++++---- tests/test_config.py | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/alembic/config.py b/alembic/config.py index 1ff2e462..47fdb3f8 100644 --- a/alembic/config.py +++ b/alembic/config.py @@ -346,8 +346,9 @@ class MessagingOptions(TypedDict, total=False): class CommandFunction(Protocol): - """A function that may be registered in the CLI as an alembic command. It must be a - named function and it must accept a :class:`.Config` object as the first argument. + """A function that may be registered in the CLI as an alembic command. + It must be a named function and it must accept a :class:`.Config` object + as the first argument. """ __name__: str @@ -563,8 +564,8 @@ class CommandLine: def register_command(self, fn: CommandFunction) -> None: """Registers a function as a CLI subcommand. The subcommand name - matches the function name, the arguments are extracted from the signature - and the help text is read from the docstring. + matches the function name, the arguments are extracted from the + signature and the help text is read from the docstring. .. seealso:: diff --git a/tests/test_config.py b/tests/test_config.py index 6a69463c..0fad0dda 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -263,7 +263,7 @@ class CommandLineTest(TestBase): cli = config.CommandLine() fake_stdout = [] - + def frobnicate(config: config.Config, revision: str) -> None: """Frobnicates the revision. @@ -281,6 +281,4 @@ class CommandLineTest(TestBase): cli.main(["frobnicate", "abc42"]) - assert fake_stdout == [ - f"Revision abc42 frobnicated." - ] + assert fake_stdout == ["Revision abc42 frobnicated."] -- 2.47.3