Coverage for tests/test_app/management/commands/help_precedence2.py: 72%
14 statements
« prev ^ index » next coverage.py v7.3.4, created at 2024-01-20 18:02 +0000
« prev ^ index » next coverage.py v7.3.4, created at 2024-01-20 18:02 +0000
1import json
3from django.utils.translation import gettext_lazy as _
5from django_typer import TyperCommand, command, initialize
8class Command(TyperCommand):
9 help = _("Test minimal TyperCommand subclass - class member")
11 @initialize(help=_("Test minimal TyperCommand subclass - callback method"))
12 def init(self, verbosity: int = 1):
13 """
14 Test minimal TyperCommand subclass - callback docstring
15 """
16 assert self.__class__ is Command
17 self.verbosity = verbosity
19 @command(help=_("Test minimal TyperCommand subclass - command method"))
20 def handle(self, arg1: str, arg2: str, arg3: float = 0.5, arg4: int = 1):
21 """
22 Test minimal TyperCommand subclass - docstring
23 """
24 assert self.__class__ == Command
25 opts = {"arg1": arg1, "arg2": arg2, "arg3": arg3, "arg4": arg4}
26 return json.dumps(opts)