From 4166a416f6cf83ee3cba8816f34ccbc018e4b3b9 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 16 May 2021 12:45:00 -0700 Subject: [PATCH] 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 --- stubs/click/click/testing.pyi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stubs/click/click/testing.pyi b/stubs/click/click/testing.pyi index d2b6e49f5..18ae5ea20 100644 --- a/stubs/click/click/testing.pyi +++ b/stubs/click/click/testing.pyi @@ -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,