summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-03-13 16:46:44 +0000
committerGitHub <noreply@github.com>2024-03-13 16:46:44 +0000
commit1e68b56a623a0d7f98106482bfed223c22193050 (patch)
tree27eeaad00c340cfcc9c4abcf67ac2ff10472a09f /tests
parentRaise poetry-core version cap to 1.9.0 (#16986) (diff)
downloadsynapse-1e68b56a623a0d7f98106482bfed223c22193050.tar.xz
Bump black from 23.10.1 to 24.2.0 (#16936)
Diffstat (limited to 'tests')
-rw-r--r--tests/replication/_base.py6
-rw-r--r--tests/rest/client/test_rooms.py12
-rw-r--r--tests/rest/client/utils.py6
-rw-r--r--tests/storage/test_cleanup_extrems.py18
-rw-r--r--tests/storage/test_room_search.py16
-rw-r--r--tests/unittest.py3
-rw-r--r--tests/util/test_linearizer.py3
-rw-r--r--tests/utils.py6
8 files changed, 34 insertions, 36 deletions
diff --git a/tests/replication/_base.py b/tests/replication/_base.py
index d2220f8195..8437da1cdd 100644
--- a/tests/replication/_base.py
+++ b/tests/replication/_base.py
@@ -495,9 +495,9 @@ class FakeRedisPubSubServer:
     """A fake Redis server for pub/sub."""
 
     def __init__(self) -> None:
-        self._subscribers_by_channel: Dict[
-            bytes, Set["FakeRedisPubSubProtocol"]
-        ] = defaultdict(set)
+        self._subscribers_by_channel: Dict[bytes, Set["FakeRedisPubSubProtocol"]] = (
+            defaultdict(set)
+        )
 
     def add_subscriber(self, conn: "FakeRedisPubSubProtocol", channel: bytes) -> None:
         """A connection has called SUBSCRIBE"""
diff --git a/tests/rest/client/test_rooms.py b/tests/rest/client/test_rooms.py
index b11a73e92b..d2f2ded487 100644
--- a/tests/rest/client/test_rooms.py
+++ b/tests/rest/client/test_rooms.py
@@ -1222,9 +1222,9 @@ class RoomJoinTestCase(RoomBase):
         """
 
         # Register a dummy callback. Make it allow all room joins for now.
-        return_value: Union[
-            Literal["NOT_SPAM"], Tuple[Codes, dict], Codes
-        ] = synapse.module_api.NOT_SPAM
+        return_value: Union[Literal["NOT_SPAM"], Tuple[Codes, dict], Codes] = (
+            synapse.module_api.NOT_SPAM
+        )
 
         async def user_may_join_room(
             userid: str,
@@ -1664,9 +1664,9 @@ class RoomMessagesTestCase(RoomBase):
         expected_fields: dict,
     ) -> None:
         class SpamCheck:
-            mock_return_value: Union[
-                str, bool, Codes, Tuple[Codes, JsonDict], bool
-            ] = "NOT_SPAM"
+            mock_return_value: Union[str, bool, Codes, Tuple[Codes, JsonDict], bool] = (
+                "NOT_SPAM"
+            )
             mock_content: Optional[JsonDict] = None
 
             async def check_event_for_spam(
diff --git a/tests/rest/client/utils.py b/tests/rest/client/utils.py
index 10cfe22d8e..daa68d78b9 100644
--- a/tests/rest/client/utils.py
+++ b/tests/rest/client/utils.py
@@ -87,8 +87,7 @@ class RestHelper:
         expect_code: Literal[200] = ...,
         extra_content: Optional[Dict] = ...,
         custom_headers: Optional[Iterable[Tuple[AnyStr, AnyStr]]] = ...,
-    ) -> str:
-        ...
+    ) -> str: ...
 
     @overload
     def create_room_as(
@@ -100,8 +99,7 @@ class RestHelper:
         expect_code: int = ...,
         extra_content: Optional[Dict] = ...,
         custom_headers: Optional[Iterable[Tuple[AnyStr, AnyStr]]] = ...,
-    ) -> Optional[str]:
-        ...
+    ) -> Optional[str]: ...
 
     def create_room_as(
         self,
diff --git a/tests/storage/test_cleanup_extrems.py b/tests/storage/test_cleanup_extrems.py
index 249c6b39f7..d5b9996284 100644
--- a/tests/storage/test_cleanup_extrems.py
+++ b/tests/storage/test_cleanup_extrems.py
@@ -337,15 +337,15 @@ class CleanupExtremDummyEventsTestCase(HomeserverTestCase):
         """Simple test to ensure that _expire_rooms_to_exclude_from_dummy_event_insertion()
         expires old entries correctly.
         """
-        self.event_creator_handler._rooms_to_exclude_from_dummy_event_insertion[
-            "1"
-        ] = 100000
-        self.event_creator_handler._rooms_to_exclude_from_dummy_event_insertion[
-            "2"
-        ] = 200000
-        self.event_creator_handler._rooms_to_exclude_from_dummy_event_insertion[
-            "3"
-        ] = 300000
+        self.event_creator_handler._rooms_to_exclude_from_dummy_event_insertion["1"] = (
+            100000
+        )
+        self.event_creator_handler._rooms_to_exclude_from_dummy_event_insertion["2"] = (
+            200000
+        )
+        self.event_creator_handler._rooms_to_exclude_from_dummy_event_insertion["3"] = (
+            300000
+        )
 
         self.event_creator_handler._expire_rooms_to_exclude_from_dummy_event_insertion()
         # All entries within time frame
diff --git a/tests/storage/test_room_search.py b/tests/storage/test_room_search.py
index 01c5324802..1eab89f140 100644
--- a/tests/storage/test_room_search.py
+++ b/tests/storage/test_room_search.py
@@ -328,9 +328,11 @@ class MessageSearchTest(HomeserverTestCase):
             self.assertEqual(
                 result["count"],
                 1 if expect_to_contain else 0,
-                f"expected '{query}' to match '{self.PHRASE}'"
-                if expect_to_contain
-                else f"'{query}' unexpectedly matched '{self.PHRASE}'",
+                (
+                    f"expected '{query}' to match '{self.PHRASE}'"
+                    if expect_to_contain
+                    else f"'{query}' unexpectedly matched '{self.PHRASE}'"
+                ),
             )
             self.assertEqual(
                 len(result["results"]),
@@ -346,9 +348,11 @@ class MessageSearchTest(HomeserverTestCase):
             self.assertEqual(
                 result["count"],
                 1 if expect_to_contain else 0,
-                f"expected '{query}' to match '{self.PHRASE}'"
-                if expect_to_contain
-                else f"'{query}' unexpectedly matched '{self.PHRASE}'",
+                (
+                    f"expected '{query}' to match '{self.PHRASE}'"
+                    if expect_to_contain
+                    else f"'{query}' unexpectedly matched '{self.PHRASE}'"
+                ),
             )
             self.assertEqual(
                 len(result["results"]),
diff --git a/tests/unittest.py b/tests/unittest.py
index 33c9a384ea..6fe0cd4a2d 100644
--- a/tests/unittest.py
+++ b/tests/unittest.py
@@ -109,8 +109,7 @@ class _TypedFailure(Generic[_ExcType], Protocol):
     """Extension to twisted.Failure, where the 'value' has a certain type."""
 
     @property
-    def value(self) -> _ExcType:
-        ...
+    def value(self) -> _ExcType: ...
 
 
 def around(target: TV) -> Callable[[Callable[Concatenate[S, P], R]], None]:
diff --git a/tests/util/test_linearizer.py b/tests/util/test_linearizer.py
index d4268bc2e2..7cbb1007da 100644
--- a/tests/util/test_linearizer.py
+++ b/tests/util/test_linearizer.py
@@ -34,8 +34,7 @@ from tests import unittest
 
 
 class UnblockFunction(Protocol):
-    def __call__(self, pump_reactor: bool = True) -> None:
-        ...
+    def __call__(self, pump_reactor: bool = True) -> None: ...
 
 
 class LinearizerTestCase(unittest.TestCase):
diff --git a/tests/utils.py b/tests/utils.py
index b5dbd60a9c..757320ebee 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -121,13 +121,11 @@ def setupdb() -> None:
 
 
 @overload
-def default_config(name: str, parse: Literal[False] = ...) -> Dict[str, object]:
-    ...
+def default_config(name: str, parse: Literal[False] = ...) -> Dict[str, object]: ...
 
 
 @overload
-def default_config(name: str, parse: Literal[True]) -> HomeServerConfig:
-    ...
+def default_config(name: str, parse: Literal[True]) -> HomeServerConfig: ...
 
 
 def default_config(