mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
zerver/lib/test_helpers.py: Improve type annotations.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from typing import cast, Any, Callable, Generator, Iterable, Tuple, Sized, Union, Optional
|
from typing import cast, Any, Callable, Dict, Generator, Iterable, List, Optional, Sized, Tuple, Union
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
@@ -62,7 +62,7 @@ def stub(obj, name, f):
|
|||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def simulated_queue_client(client):
|
def simulated_queue_client(client):
|
||||||
# type: (Any) -> Generator[None, None, None]
|
# type: (type) -> Generator[None, None, None]
|
||||||
real_SimpleQueueClient = queue_processors.SimpleQueueClient
|
real_SimpleQueueClient = queue_processors.SimpleQueueClient
|
||||||
queue_processors.SimpleQueueClient = client # type: ignore # https://github.com/JukkaL/mypy/issues/1152
|
queue_processors.SimpleQueueClient = client # type: ignore # https://github.com/JukkaL/mypy/issues/1152
|
||||||
yield
|
yield
|
||||||
@@ -70,7 +70,7 @@ def simulated_queue_client(client):
|
|||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def tornado_redirected_to_list(lst):
|
def tornado_redirected_to_list(lst):
|
||||||
# type: (List) -> Generator[None, None, None]
|
# type: (List[Dict[str, Any]]) -> Generator[None, None, None]
|
||||||
real_event_queue_process_notification = event_queue.process_notification
|
real_event_queue_process_notification = event_queue.process_notification
|
||||||
event_queue.process_notification = lst.append
|
event_queue.process_notification = lst.append
|
||||||
yield
|
yield
|
||||||
@@ -191,7 +191,7 @@ class DummyTornadoRequest(object):
|
|||||||
|
|
||||||
class DummyHandler(object):
|
class DummyHandler(object):
|
||||||
def __init__(self, assert_callback):
|
def __init__(self, assert_callback):
|
||||||
# type: (Any) -> None
|
# type: (Callable) -> None
|
||||||
self.assert_callback = assert_callback
|
self.assert_callback = assert_callback
|
||||||
self.request = DummyTornadoRequest()
|
self.request = DummyTornadoRequest()
|
||||||
allocate_handler_id(self)
|
allocate_handler_id(self)
|
||||||
|
|||||||
Reference in New Issue
Block a user