diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2022-04-01 17:04:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-01 16:04:16 +0000 |
commit | f0b03186d96305fd44d74a89bf4230beec0c5c31 (patch) | |
tree | 3452c18b9205bc18584ea8b4fb43c4e8a2912fef /tests/server.py | |
parent | Remove redundant `get_success` calls in test code (#12346) (diff) | |
download | synapse-f0b03186d96305fd44d74a89bf4230beec0c5c31.tar.xz |
Add type hints for `tests/unittest.py`. (#12347)
In particular, add type hints for get_success and friends, which are then helpful in a bunch of places.
Diffstat (limited to 'tests/server.py')
-rw-r--r-- | tests/server.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/server.py b/tests/server.py index 6ce2a17bf4..aaa5ca3e74 100644 --- a/tests/server.py +++ b/tests/server.py @@ -22,7 +22,6 @@ import warnings from collections import deque from io import SEEK_END, BytesIO from typing import ( - AnyStr, Callable, Dict, Iterable, @@ -86,6 +85,9 @@ from tests.utils import ( logger = logging.getLogger(__name__) +# the type of thing that can be passed into `make_request` in the headers list +CustomHeaderType = Tuple[Union[str, bytes], Union[str, bytes]] + class TimedOutException(Exception): """ @@ -260,7 +262,7 @@ def make_request( federation_auth_origin: Optional[bytes] = None, content_is_form: bool = False, await_result: bool = True, - custom_headers: Optional[Iterable[Tuple[AnyStr, AnyStr]]] = None, + custom_headers: Optional[Iterable[CustomHeaderType]] = None, client_ip: str = "127.0.0.1", ) -> FakeChannel: """ |