Correct return type of click.testing.CliRunner.isolation() (#5103)

The method returns a tuple of io.BytesIO objects that hold the temporary
stdin and stdout. By correcting the type, it allows usages of
io.BytesIO.getvalue() to pass type checking.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Jon Dufresne
2021-05-16 12:45:00 -07:00
committed by GitHub
parent e5abd08f93
commit 4166a416f6

View File

@@ -1,4 +1,6 @@
from typing import IO, Any, BinaryIO, ContextManager, Dict, Iterable, List, Mapping, Optional, Text, Union
import io
from typing import IO, Any, BinaryIO, ContextManager, Dict, Iterable, List, Mapping, Optional, Text, Tuple, Union
from typing_extensions import Literal
from .core import BaseCommand
@@ -53,7 +55,7 @@ class CliRunner:
def make_env(self, overrides: Optional[Mapping[str, str]] = ...) -> Dict[str, str]: ...
def isolation(
self, input: Optional[Union[bytes, Text, IO[Any]]] = ..., env: Optional[Mapping[str, str]] = ..., color: bool = ...
) -> ContextManager[BinaryIO]: ...
) -> ContextManager[Tuple[io.BytesIO, Union[io.BytesIO, Literal[False]]]]: ...
def invoke(
self,
cli: BaseCommand,