Run mypy on zerver/lib/test_subs.py.

This commit is contained in:
Tim Abbott 2016-06-02 22:57:07 -07:00
parent 1bdbdd1110
commit f3b07ee9aa
2 changed files with 8 additions and 7 deletions

View File

@ -27,7 +27,6 @@ zerver/tests/test_email_mirror.py
zerver/tests/test_decorators.py zerver/tests/test_decorators.py
zerver/tests/test_auth_backends.py zerver/tests/test_auth_backends.py
zerver/tests/test_upload.py zerver/tests/test_upload.py
zerver/tests/test_subs.py
zerver/tests/test_messages.py zerver/tests/test_messages.py
zerver/tests/test_hooks.py zerver/tests/test_hooks.py
""".split() """.split()

View File

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import from __future__ import absolute_import
from typing import Any, Dict, List
from zerver.lib import cache from zerver.lib import cache
from zerver.lib.test_helpers import ( from zerver.lib.test_helpers import (
@ -114,7 +116,7 @@ class StreamAdminTest(AuthedTestCase):
do_add_subscription(user_profile, stream, no_log=True) do_add_subscription(user_profile, stream, no_log=True)
do_change_is_admin(user_profile, True) do_change_is_admin(user_profile, True)
events = [] events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events): with tornado_redirected_to_list(events):
result = self.client.post('/json/rename_stream?old_name=stream_name1&new_name=stream_name2') result = self.client.post('/json/rename_stream?old_name=stream_name1&new_name=stream_name2')
self.assert_json_success(result) self.assert_json_success(result)
@ -160,7 +162,7 @@ class StreamAdminTest(AuthedTestCase):
do_add_subscription(user_profile, stream, no_log=True) do_add_subscription(user_profile, stream, no_log=True)
do_change_is_admin(user_profile, True) do_change_is_admin(user_profile, True)
events = [] events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events): with tornado_redirected_to_list(events):
result = self.client_patch('/json/streams/stream_name1', result = self.client_patch('/json/streams/stream_name1',
{'description': ujson.dumps('Test description')}) {'description': ujson.dumps('Test description')})
@ -222,7 +224,7 @@ class StreamAdminTest(AuthedTestCase):
""" """
active_name = stream.name active_name = stream.name
events = [] events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events): with tornado_redirected_to_list(events):
result = self.client.delete('/json/streams/' + active_name) result = self.client.delete('/json/streams/' + active_name)
self.assert_json_success(result) self.assert_json_success(result)
@ -738,7 +740,7 @@ class SubscriptionAPITest(AuthedTestCase):
self.assertNotEqual(len(self.streams), 0) # necessary for full test coverage self.assertNotEqual(len(self.streams), 0) # necessary for full test coverage
add_streams = ["Verona2", "Denmark5"] add_streams = ["Verona2", "Denmark5"]
self.assertNotEqual(len(add_streams), 0) # necessary for full test coverage self.assertNotEqual(len(add_streams), 0) # necessary for full test coverage
events = [] events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events): with tornado_redirected_to_list(events):
self.helper_check_subs_before_and_after_add(self.streams + add_streams, {}, self.helper_check_subs_before_and_after_add(self.streams + add_streams, {},
add_streams, self.streams, self.test_email, self.streams + add_streams) add_streams, self.streams, self.test_email, self.streams + add_streams)
@ -928,7 +930,7 @@ class SubscriptionAPITest(AuthedTestCase):
email2 = 'iago@zulip.com' email2 = 'iago@zulip.com'
realm = get_realm("zulip.com") realm = get_realm("zulip.com")
streams_to_sub = ['multi_user_stream'] streams_to_sub = ['multi_user_stream']
events = [] events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events): with tornado_redirected_to_list(events):
with queries_captured() as queries: with queries_captured() as queries:
self.common_subscribe_to_streams( self.common_subscribe_to_streams(
@ -1009,7 +1011,7 @@ class SubscriptionAPITest(AuthedTestCase):
for stream in streams: for stream in streams:
create_stream_if_needed(realm, stream) create_stream_if_needed(realm, stream)
events = [] events = [] # type: List[Dict[str, Any]]
with tornado_redirected_to_list(events): with tornado_redirected_to_list(events):
with queries_captured() as queries: with queries_captured() as queries:
self.common_subscribe_to_streams( self.common_subscribe_to_streams(