summary refs log tree commit diff
path: root/tests/server.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2021-11-12 15:50:54 +0000
committerGitHub <noreply@github.com>2021-11-12 15:50:54 +0000
commit4c96ce396e900a94af66ec070af925881b6e1e24 (patch)
tree446920e10d66c2ace553a68541ed64e0fbd543e1 /tests/server.py
parentGeneralize the disallowed_untyped_defs in mypy.ini (#11322) (diff)
downloadsynapse-4c96ce396e900a94af66ec070af925881b6e1e24.tar.xz
Misc typing fixes for `tests`, part 1 of N (#11323)
* Annotate HomeserverTestCase.servlets
* Correct annotation of federation_auth_origin
* Use AnyStr custom_headers instead of a Union

This allows (str, str) and (bytes, bytes).
This disallows (str, bytes) and (bytes, str)

* DomainSpecificString.SIGIL is a ClassVar
Diffstat (limited to 'tests/server.py')
-rw-r--r--tests/server.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/server.py b/tests/server.py

index 103351b487..a7cc5cd325 100644 --- a/tests/server.py +++ b/tests/server.py
@@ -16,7 +16,16 @@ import json import logging from collections import deque from io import SEEK_END, BytesIO -from typing import Callable, Dict, Iterable, MutableMapping, Optional, Tuple, Union +from typing import ( + AnyStr, + Callable, + Dict, + Iterable, + MutableMapping, + Optional, + Tuple, + Union, +) import attr from typing_extensions import Deque @@ -222,9 +231,7 @@ def make_request( federation_auth_origin: Optional[bytes] = None, content_is_form: bool = False, await_result: bool = True, - custom_headers: Optional[ - Iterable[Tuple[Union[bytes, str], Union[bytes, str]]] - ] = None, + custom_headers: Optional[Iterable[Tuple[AnyStr, AnyStr]]] = None, client_ip: str = "127.0.0.1", ) -> FakeChannel: """