python: Modernize legacy Python 2 syntax with pyupgrade.

Generated by `pyupgrade --py3-plus --keep-percent-format` on all our
Python code except `zthumbor` and `zulip-ec2-configure-interfaces`,
followed by manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg
2020-04-09 12:51:58 -07:00
committed by Tim Abbott
parent fff2d3958a
commit c734bbd95d
567 changed files with 1877 additions and 2564 deletions

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from zerver.lib.test_classes import WebhookTestCase
@@ -8,61 +7,61 @@ class GoogleCodeInTests(WebhookTestCase):
FIXTURE_DIR_NAME = 'gci'
def test_abandon_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**student-yqqtag** abandoned the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
expected_topic = 'student-yqqtag'
expected_message = '**student-yqqtag** abandoned the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
self.send_and_test_stream_message('task_abandoned_by_student',
expected_topic, expected_message)
def test_comment_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**student-yqqtag** commented on the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
expected_topic = 'student-yqqtag'
expected_message = '**student-yqqtag** commented on the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
self.send_and_test_stream_message('student_commented_on_task',
expected_topic, expected_message)
def test_submit_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**student-yqqtag** submitted the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
expected_topic = 'student-yqqtag'
expected_message = '**student-yqqtag** submitted the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
self.send_and_test_stream_message('task_submitted_by_student',
expected_topic, expected_message)
def test_claim_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**student-yqqtag** claimed the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
expected_topic = 'student-yqqtag'
expected_message = '**student-yqqtag** claimed the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
self.send_and_test_stream_message('task_claimed_by_student',
expected_topic, expected_message)
def test_approve_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**eeshangarg** approved the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
expected_topic = 'student-yqqtag'
expected_message = '**eeshangarg** approved the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
self.send_and_test_stream_message('task_approved_by_mentor',
expected_topic, expected_message)
def test_approve_pending_pc_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**eeshangarg** approved the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/) (pending parental consent).'
expected_topic = 'student-yqqtag'
expected_message = '**eeshangarg** approved the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/) (pending parental consent).'
self.send_and_test_stream_message('task_approved_by_mentor_pending_parental_consent',
expected_topic, expected_message)
def test_needswork_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**eeshangarg** submitted the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/5136918324969472/) for more work.'
expected_topic = 'student-yqqtag'
expected_message = '**eeshangarg** submitted the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/5136918324969472/) for more work.'
self.send_and_test_stream_message('task_submitted_by_mentor_for_more_work',
expected_topic, expected_message)
def test_extend_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**eeshangarg** extended the deadline for the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/) by 1.0 day(s).'
expected_topic = 'student-yqqtag'
expected_message = '**eeshangarg** extended the deadline for the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/) by 1.0 day(s).'
self.send_and_test_stream_message('task_deadline_extended_by_mentor',
expected_topic, expected_message)
def test_unassign_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'**eeshangarg** unassigned **student-yqqtag** from the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
expected_topic = 'student-yqqtag'
expected_message = '**eeshangarg** unassigned **student-yqqtag** from the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6296903092273152/).'
self.send_and_test_stream_message('student_unassigned_by_mentor',
expected_topic, expected_message)
def test_outoftime_event_message(self) -> None:
expected_topic = u'student-yqqtag'
expected_message = u'The deadline for the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6694926301528064/) has passed.'
expected_topic = 'student-yqqtag'
expected_message = 'The deadline for the task [Sails unspread it stopped at kearney](https://codein.withgoogle.com/dashboard/task-instances/6694926301528064/) has passed.'
self.send_and_test_stream_message('task_deadline_has_passed',
expected_topic, expected_message)