Skip to content

Commit

Permalink
Add type hints to fake_filesystem_unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbean-bremen committed Jul 13, 2021
1 parent dfa0262 commit e6ef935
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 125 deletions.
14 changes: 10 additions & 4 deletions pyfakefs/fake_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@
from stat import (
S_IFREG, S_IFDIR, S_ISLNK, S_IFMT, S_ISDIR, S_IFLNK, S_ISREG, S_IFSOCK
)
from types import ModuleType
from types import ModuleType, TracebackType
from typing import (
List, Optional, Callable, Union, Any, Dict, Tuple, cast, AnyStr, overload,
NoReturn, ClassVar, IO, Iterator, TextIO
NoReturn, ClassVar, IO, Iterator, TextIO, Type
)
from pyfakefs.deprecator import Deprecator
from pyfakefs.extra_packages import use_scandir
Expand Down Expand Up @@ -4926,7 +4926,10 @@ def __enter__(self) -> 'FakeFileWrapper':
"""To support usage of this fake file with the 'with' statement."""
return self

def __exit__(self, type: Any, value: Any, traceback: Any) -> None:
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType]
) -> None:
"""To support usage of this fake file with the 'with' statement."""
self.close()

Expand Down Expand Up @@ -5387,7 +5390,10 @@ def __enter__(self) -> 'FakePipeWrapper':
"""To support usage of this fake pipe with the 'with' statement."""
return self

def __exit__(self, type: Any, value: Any, traceback: Any) -> None:
def __exit__(self, exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType]
) -> None:
"""To support usage of this fake pipe with the 'with' statement."""
self.close()

Expand Down
Loading

0 comments on commit e6ef935

Please sign in to comment.