From a8703270da51db40e1c2638ff401ab018df3f365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20V=C3=A9zina?= Date: Wed, 30 Mar 2016 16:20:02 -0400 Subject: [PATCH] PEP8 enhancement --- gluon/tests/test_tools.py | 63 ++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/gluon/tests/test_tools.py b/gluon/tests/test_tools.py index b89d5364..d1c9e527 100644 --- a/gluon/tests/test_tools.py +++ b/gluon/tests/test_tools.py @@ -29,6 +29,7 @@ from gluon.http import HTTP python_version = sys.version[:3] IS_IMAP = "imap" in DEFAULT_URI + @unittest.skipIf(IS_IMAP, "TODO: Imap raises 'Connection refused'") class TestAuth(unittest.TestCase): @@ -102,7 +103,7 @@ class TestMail(unittest.TestCase): users = {} def __init__(self, address, port, **kwargs): - self.address=address + self.address = address self.port = port self.has_quit = False self.tls = False @@ -110,14 +111,14 @@ class TestMail(unittest.TestCase): def login(self, username, password): if username not in self.users or self.users[username] != password: raise smtplib.SMTPAuthenticationError - self.username=username - self.password=password + self.username = username + self.password = password def sendmail(self, sender, to, payload): self.inbox.append(TestMail.Message(sender, to, payload)) def quit(self): - self.has_quit=True + self.has_quit = True def ehlo(self, hostname=None): pass @@ -125,7 +126,6 @@ class TestMail(unittest.TestCase): def starttls(self): self.tls = True - def setUp(self): self.original_SMTP = smtplib.SMTP self.original_SMTP_SSL = smtplib.SMTP_SSL @@ -141,10 +141,10 @@ class TestMail(unittest.TestCase): mail.settings.server = 'smtp.example.com:25' mail.settings.sender = 'you@example.com' self.assertTrue(mail.send(to=['somebody@example.com'], - subject='hello', - # If reply_to is omitted, then mail.settings.sender is used - reply_to='us@example.com', - message='world')) + subject='hello', + # If reply_to is omitted, then mail.settings.sender is used + reply_to='us@example.com', + message='world')) message = TestMail.DummySMTP.inbox.pop() self.assertEqual(message.sender, mail.settings.sender) self.assertEqual(message.to, ['somebody@example.com']) @@ -158,10 +158,10 @@ class TestMail(unittest.TestCase): mail.settings.sender = 'you@example.com' mail.settings.login = 'username:password' self.assertFalse(mail.send(to=['somebody@example.com'], - subject='hello', - # If reply_to is omitted, then mail.settings.sender is used - reply_to='us@example.com', - message='world')) + subject='hello', + # If reply_to is omitted, then mail.settings.sender is used + reply_to='us@example.com', + message='world')) def test_login(self): TestMail.DummySMTP.users['username'] = 'password' @@ -170,10 +170,10 @@ class TestMail(unittest.TestCase): mail.settings.sender = 'you@example.com' mail.settings.login = 'username:password' self.assertTrue(mail.send(to=['somebody@example.com'], - subject='hello', - # If reply_to is omitted, then mail.settings.sender is used - reply_to='us@example.com', - message='world')) + subject='hello', + # If reply_to is omitted, then mail.settings.sender is used + reply_to='us@example.com', + message='world')) del TestMail.DummySMTP.users['username'] TestMail.DummySMTP.inbox.pop() @@ -182,10 +182,10 @@ class TestMail(unittest.TestCase): mail.settings.server = 'smtp.example.com:25' mail.settings.sender = 'you@example.com' self.assertTrue(mail.send(to=['somebody@example.com'], - subject='hello', - # If reply_to is omitted, then mail.settings.sender is used - reply_to='us@example.com', - message='')) + subject='hello', + # If reply_to is omitted, then mail.settings.sender is used + reply_to='us@example.com', + message='')) message = TestMail.DummySMTP.inbox.pop() self.assertTrue('Content-Type: text/html' in message.payload) @@ -195,10 +195,10 @@ class TestMail(unittest.TestCase): mail.settings.sender = 'you@example.com' mail.settings.ssl = True self.assertTrue(mail.send(to=['somebody@example.com'], - subject='hello', - # If reply_to is omitted, then mail.settings.sender is used - reply_to='us@example.com', - message='world')) + subject='hello', + # If reply_to is omitted, then mail.settings.sender is used + reply_to='us@example.com', + message='world')) TestMail.DummySMTP.inbox.pop() def test_tls(self): @@ -207,16 +207,11 @@ class TestMail(unittest.TestCase): mail.settings.sender = 'you@example.com' mail.settings.tls = True self.assertTrue(mail.send(to=['somebody@example.com'], - subject='hello', - # If reply_to is omitted, then mail.settings.sender is used - reply_to='us@example.com', - message='world')) + subject='hello', + # If reply_to is omitted, then mail.settings.sender is used + reply_to='us@example.com', + message='world')) TestMail.DummySMTP.inbox.pop() - - - - - if __name__ == '__main__': unittest.main()