Coverage for tests/test_app/management/commands/test_tb_overrides.py: 0%

15 statements  

« prev     ^ index     » next       coverage.py v7.3.4, created at 2024-01-20 17:58 +0000

1import json 

2 

3from django_typer import TyperCommand, command, initialize 

4 

5 

6class Command( 

7 TyperCommand, 

8 pretty_exceptions_enable=True, 

9 pretty_exceptions_show_locals=False, 

10 pretty_exceptions_short=False, 

11): 

12 help = "This is a test help message" 

13 

14 @initialize(epilog="This is a test callback epilog") 

15 def preamble(self, pre_arg: str = "pre_arg"): 

16 print(f"This is a test preamble, {pre_arg}") 

17 

18 @command(epilog="This is a test epilog") 

19 def delete(self, name: str, formal: bool = False, throw: bool = False): 

20 """Delete something""" 

21 if throw: 

22 raise Exception("This is a test exception") 

23 print(json.dumps({"name": name, "formal": formal})) 

24 

25 @command(epilog="This is a test epilog") 

26 def create(self, name: str, number: int, switch: bool = False): 

27 """This is a test create command""" 

28 print(json.dumps({"name": name, "number": number, "switch": switch}))