Coverage for typer/testing.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 18:26 +0000

1from typing import IO, Any, Mapping, Optional, Sequence, Union 1habcdefg

2 

3from click.testing import CliRunner as ClickCliRunner # noqa 1habcdefg

4from click.testing import Result 1habcdefg

5from typer.main import Typer 1habcdefg

6from typer.main import get_command as _get_command 1habcdefg

7 

8 

9class CliRunner(ClickCliRunner): 1habcdefg

10 def invoke( # type: ignore 1abcdefg

11 self, 

12 app: Typer, 

13 args: Optional[Union[str, Sequence[str]]] = None, 

14 input: Optional[Union[bytes, str, IO[Any]]] = None, 

15 env: Optional[Mapping[str, str]] = None, 

16 catch_exceptions: bool = True, 

17 color: bool = False, 

18 **extra: Any, 

19 ) -> Result: 

20 use_cli = _get_command(app) 1habcdefg

21 return super().invoke( 1habcdefg

22 use_cli, 

23 args=args, 

24 input=input, 

25 env=env, 

26 catch_exceptions=catch_exceptions, 

27 color=color, 

28 **extra, 

29 )