zerver/tests: Remove `import six`.

This commit is contained in:
rht 2017-09-27 10:11:59 +02:00 committed by Tim Abbott
parent a7803cbf1b
commit daef6a7dbc
3 changed files with 9 additions and 12 deletions

View File

@ -40,7 +40,6 @@ import copy
import mock import mock
import os import os
import ujson import ujson
import six
from six.moves import urllib from six.moves import urllib
from zerver.lib.str_utils import NonBinaryStr from zerver.lib.str_utils import NonBinaryStr
@ -182,7 +181,7 @@ class BugdownTest(ZulipTestCase):
# type: () -> None # type: () -> None
format_tests, linkify_tests = self.load_bugdown_tests() format_tests, linkify_tests = self.load_bugdown_tests()
for name, test in six.iteritems(format_tests): for name, test in format_tests.items():
converted = bugdown_convert(test['input']) converted = bugdown_convert(test['input'])
print("Running Bugdown test %s" % (name,)) print("Running Bugdown test %s" % (name,))

View File

@ -57,7 +57,6 @@ from django.http import HttpResponse
import mock import mock
import random import random
import ujson import ujson
import six
from six.moves import range, urllib, zip from six.moves import range, urllib, zip
class TestCreateStreams(ZulipTestCase): class TestCreateStreams(ZulipTestCase):
@ -1319,8 +1318,8 @@ class SubscriptionAPITest(ZulipTestCase):
json = result.json() json = result.json()
self.assertIn("subscriptions", json) self.assertIn("subscriptions", json)
for stream in json['subscriptions']: for stream in json['subscriptions']:
self.assertIsInstance(stream['name'], six.string_types) self.assertIsInstance(stream['name'], str)
self.assertIsInstance(stream['color'], six.string_types) self.assertIsInstance(stream['color'], str)
self.assertIsInstance(stream['invite_only'], bool) self.assertIsInstance(stream['invite_only'], bool)
# check that the stream name corresponds to an actual # check that the stream name corresponds to an actual
# stream; will throw Stream.DoesNotExist if it doesn't # stream; will throw Stream.DoesNotExist if it doesn't
@ -1971,7 +1970,7 @@ class SubscriptionAPITest(ZulipTestCase):
{"subscriptions": ujson.dumps(subscriptions)}) {"subscriptions": ujson.dumps(subscriptions)})
self.assert_json_success(result) self.assert_json_success(result)
json = result.json() json = result.json()
for key, val in six.iteritems(json_dict): for key, val in json_dict.items():
self.assertEqual(sorted(val), sorted(json[key])) # we don't care about the order of the items self.assertEqual(sorted(val), sorted(json[key])) # we don't care about the order of the items
new_streams = self.get_streams(email, realm) new_streams = self.get_streams(email, realm)
self.assertEqual(sorted(new_streams), sorted(new_subs)) self.assertEqual(sorted(new_streams), sorted(new_subs))
@ -2646,7 +2645,7 @@ class GetSubscribersTest(ZulipTestCase):
self.assertIsInstance(result_dict['subscribers'], list) self.assertIsInstance(result_dict['subscribers'], list)
subscribers = [] # type: List[Text] subscribers = [] # type: List[Text]
for subscriber in result_dict['subscribers']: for subscriber in result_dict['subscribers']:
self.assertIsInstance(subscriber, six.string_types) self.assertIsInstance(subscriber, str)
subscribers.append(subscriber) subscribers.append(subscriber)
self.assertEqual(set(subscribers), set(expected_subscribers)) self.assertEqual(set(subscribers), set(expected_subscribers))

View File

@ -3,7 +3,6 @@ from __future__ import print_function
import importlib import importlib
import os import os
import six
import ujson import ujson
import django.core.urlresolvers import django.core.urlresolvers
@ -80,13 +79,13 @@ class PublicURLTest(ZulipTestCase):
} }
put_urls = {401: ["/json/users/me/pointer"], put_urls = {401: ["/json/users/me/pointer"],
} }
for status_code, url_set in six.iteritems(get_urls): for status_code, url_set in get_urls.items():
self.fetch("client_get", url_set, status_code) self.fetch("client_get", url_set, status_code)
for status_code, url_set in six.iteritems(post_urls): for status_code, url_set in post_urls.items():
self.fetch("client_post", url_set, status_code) self.fetch("client_post", url_set, status_code)
for status_code, url_set in six.iteritems(patch_urls): for status_code, url_set in patch_urls.items():
self.fetch("client_patch", url_set, status_code) self.fetch("client_patch", url_set, status_code)
for status_code, url_set in six.iteritems(put_urls): for status_code, url_set in put_urls.items():
self.fetch("client_put", url_set, status_code) self.fetch("client_put", url_set, status_code)
def test_get_gcid_when_not_configured(self): def test_get_gcid_when_not_configured(self):