mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-30 06:17:16 -04:00
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
This commit is contained in:
parent
95547e5300
commit
4c96ce396e
7 changed files with 53 additions and 29 deletions
|
@ -19,7 +19,17 @@ import json
|
|||
import re
|
||||
import time
|
||||
import urllib.parse
|
||||
from typing import Any, Dict, Iterable, Mapping, MutableMapping, Optional, Tuple, Union
|
||||
from typing import (
|
||||
Any,
|
||||
AnyStr,
|
||||
Dict,
|
||||
Iterable,
|
||||
Mapping,
|
||||
MutableMapping,
|
||||
Optional,
|
||||
Tuple,
|
||||
Union,
|
||||
)
|
||||
from unittest.mock import patch
|
||||
|
||||
import attr
|
||||
|
@ -53,9 +63,7 @@ class RestHelper:
|
|||
tok: Optional[str] = None,
|
||||
expect_code: int = 200,
|
||||
extra_content: Optional[Dict] = None,
|
||||
custom_headers: Optional[
|
||||
Iterable[Tuple[Union[bytes, str], Union[bytes, str]]]
|
||||
] = None,
|
||||
custom_headers: Optional[Iterable[Tuple[AnyStr, AnyStr]]] = None,
|
||||
) -> str:
|
||||
"""
|
||||
Create a room.
|
||||
|
@ -227,9 +235,7 @@ class RestHelper:
|
|||
txn_id=None,
|
||||
tok=None,
|
||||
expect_code=200,
|
||||
custom_headers: Optional[
|
||||
Iterable[Tuple[Union[bytes, str], Union[bytes, str]]]
|
||||
] = None,
|
||||
custom_headers: Optional[Iterable[Tuple[AnyStr, AnyStr]]] = None,
|
||||
):
|
||||
if body is None:
|
||||
body = "body_text_here"
|
||||
|
@ -418,7 +424,7 @@ class RestHelper:
|
|||
path,
|
||||
content=image_data,
|
||||
access_token=tok,
|
||||
custom_headers=[(b"Content-Length", str(image_length))],
|
||||
custom_headers=[("Content-Length", str(image_length))],
|
||||
)
|
||||
|
||||
assert channel.code == expect_code, "Expected: %d, got: %d, resp: %r" % (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue