-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
445 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/apps/test_app/management/commands/dj_params_all_suppressed.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django_typer.management import TyperCommand, COMMON_DEFAULTS | ||
from typer.models import Context as TyperContext | ||
|
||
|
||
class Command(TyperCommand): | ||
help = "Test that django parameter suppression works as expected" | ||
|
||
suppressed_base_arguments = set(COMMON_DEFAULTS.keys()) | ||
|
||
def handle(self, ctx: TyperContext): | ||
assert self.__class__ is Command | ||
assert isinstance(ctx, TyperContext) | ||
assert not ctx.params |
20 changes: 20 additions & 0 deletions
20
tests/apps/test_app/management/commands/dj_params_all_suppressed_init.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from django_typer.management import TyperCommand, COMMON_DEFAULTS, initialize, command | ||
from typer.models import Context as TyperContext | ||
|
||
|
||
class Command(TyperCommand): | ||
help = "Test that django parameter suppression works as expected" | ||
|
||
suppressed_base_arguments = set(COMMON_DEFAULTS.keys()) | ||
|
||
@initialize() | ||
def init(self, ctx: TyperContext): | ||
assert self.__class__ is Command | ||
assert isinstance(ctx, TyperContext) | ||
assert not ctx.params | ||
|
||
@command(name="cmd") | ||
def handle(self, ctx: TyperContext): | ||
assert self.__class__ is Command | ||
assert isinstance(ctx, TyperContext) | ||
assert not ctx.params |
Oops, something went wrong.