Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix mypy thinking RoomBase.servlets is a List[function]
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Quah <[email protected]>
  • Loading branch information
Sean Quah authored and Sean Quah committed May 13, 2022
1 parent ee4b420 commit 92045c8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/rest/client/test_rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""Tests REST events for /rooms paths."""

import json
from typing import Any, Dict, Iterable, List, Optional
from typing import Any, ClassVar, Dict, Iterable, List, Optional
from unittest.mock import Mock, call
from urllib import parse as urlparse

Expand All @@ -33,7 +33,7 @@
)
from synapse.api.errors import Codes, HttpResponseException
from synapse.handlers.pagination import PurgeStatus
from synapse.rest import admin
from synapse.rest import RegisterServletsFunc, admin
from synapse.rest.client import account, directory, login, profile, room, sync
from synapse.server import HomeServer
from synapse.types import JsonDict, RoomAlias, UserID, create_requester
Expand All @@ -49,7 +49,12 @@
class RoomBase(unittest.HomeserverTestCase):
rmcreator_id: Optional[str] = None

servlets = [room.register_servlets, room.register_deprecated_servlets]
# mypy: `room.register_servlets` has an extra parameter, so mypy thinks `servlets`
# is a `List[function]` without the hint.
servlets: ClassVar[List[RegisterServletsFunc]] = [
room.register_servlets,
room.register_deprecated_servlets,
]

def make_homeserver(self, reactor: MemoryReactor, clock: Clock) -> HomeServer:

Expand Down

0 comments on commit 92045c8

Please sign in to comment.