summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-08-11 10:43:40 -0400
committerGitHub <noreply@github.com>2021-08-11 10:43:40 -0400
commitfab352ac2cb6a9d69a74be6d4255a9b71e0f7945 (patch)
treecb219d3166c1efad89f95e277b81420b37be93bb /tests
parentsupport federation queries through http connect proxy (#10475) (diff)
downloadsynapse-fab352ac2cb6a9d69a74be6d4255a9b71e0f7945.tar.xz
Fix type hints in space summary tests. (#10575)
And ensure that the file is checked via mypy.
Diffstat (limited to 'tests')
-rw-r--r--tests/handlers/test_space_summary.py11
-rw-r--r--tests/rest/client/v1/utils.py6
2 files changed, 8 insertions, 9 deletions
diff --git a/tests/handlers/test_space_summary.py b/tests/handlers/test_space_summary.py
index 255dd17f86..04da9bcc25 100644
--- a/tests/handlers/test_space_summary.py
+++ b/tests/handlers/test_space_summary.py
@@ -11,7 +11,7 @@
 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
-from typing import Any, Iterable, Optional, Tuple
+from typing import Any, Iterable, List, Optional, Tuple
 from unittest import mock
 
 from synapse.api.constants import (
@@ -127,7 +127,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         self, space_id: str, room_id: str, token: str, order: Optional[str] = None
     ) -> None:
         """Add a child room to a space."""
-        content = {"via": [self.hs.hostname]}
+        content: JsonDict = {"via": [self.hs.hostname]}
         if order is not None:
             content["order"] = order
         self.helper.send_state(
@@ -439,9 +439,8 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         )
         # The result should have the space and all of the links, plus some of the
         # rooms and a pagination token.
-        expected = [(self.space, room_ids)] + [
-            (room_id, ()) for room_id in room_ids[:6]
-        ]
+        expected: List[Tuple[str, Iterable[str]]] = [(self.space, room_ids)]
+        expected += [(room_id, ()) for room_id in room_ids[:6]]
         self._assert_hierarchy(result, expected)
         self.assertIn("next_token", result)
 
@@ -525,7 +524,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
         result = self.get_success(
             self.handler.get_room_hierarchy(self.user, self.space, max_depth=0)
         )
-        expected = [(spaces[0], [rooms[0], spaces[1]])]
+        expected: List[Tuple[str, Iterable[str]]] = [(spaces[0], [rooms[0], spaces[1]])]
         self._assert_hierarchy(result, expected)
 
         # A single additional layer.
diff --git a/tests/rest/client/v1/utils.py b/tests/rest/client/v1/utils.py
index fc2d35596e..954ad1a1fd 100644
--- a/tests/rest/client/v1/utils.py
+++ b/tests/rest/client/v1/utils.py
@@ -47,10 +47,10 @@ class RestHelper:
 
     def create_room_as(
         self,
-        room_creator: str = None,
+        room_creator: Optional[str] = None,
         is_public: bool = True,
-        room_version: str = None,
-        tok: str = None,
+        room_version: Optional[str] = None,
+        tok: Optional[str] = None,
         expect_code: int = 200,
         extra_content: Optional[Dict] = None,
         custom_headers: Optional[