Fix errors in stubs when running in strict mode (#515)

This commit is contained in:
Danny Weinberg
2016-09-02 19:04:56 -07:00
committed by Guido van Rossum
parent 23c44d3e36
commit 708fd960da
2 changed files with 8 additions and 4 deletions

View File

@@ -3,7 +3,8 @@
# based on http://docs.python.org/3.3/library/tempfile.html
from typing import Tuple, BinaryIO
from types import TracebackType
from typing import BinaryIO, Optional, Tuple, Type
# global variables
tempdir = ... # type: str
@@ -20,7 +21,7 @@ def TemporaryFile(
def NamedTemporaryFile(
mode: str = ..., buffering: int = ..., encoding: str = ...,
newline: str = ..., suffix: str = ..., prefix: str = ...,
dir: str = ..., delete=...) -> BinaryIO:
dir: str = ..., delete: bool =...) -> BinaryIO:
...
def SpooledTemporaryFile(
max_size: int = ..., mode: str = ..., buffering: int = ...,
@@ -34,7 +35,9 @@ class TemporaryDirectory:
dir: str = ...) -> None: ...
def cleanup(self) -> None: ...
def __enter__(self) -> str: ...
def __exit__(self, type, value, traceback) -> bool: ...
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[Exception],
exc_tb: Optional[TracebackType]) -> bool: ...
def mkstemp(suffix: str = ..., prefix: str = ..., dir: str = ...,
text: bool = ...) -> Tuple[int, str]: ...

View File

@@ -8,6 +8,7 @@ from typing import (
import logging
import sys
from types import ModuleType, TracebackType
from contextlib import ContextManager
_T = TypeVar('_T')
@@ -37,7 +38,7 @@ class TestCase:
def run(self, result: Optional[TestResult] = ...) -> TestCase: ...
def skipTest(self, reason: Any) -> None: ...
if sys.version_info >= (3, 4):
def subTest(self, msg: Any = ..., **params: Any) -> None: ...
def subTest(self, msg: Any = ..., **params: Any) -> ContextManager[None]: ...
def debug(self) -> None: ...
def assertEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ...
def assertNotEqual(self, first: Any, second: Any,