Skip to content

Commit dc6cf5f

Browse files
committed
Finish pep8-ing the tests
1 parent c14c5f8 commit dc6cf5f

6 files changed

Lines changed: 37 additions & 26 deletions

File tree

tests/test_events.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ class TestPayloadHandlers(TestCase):
4141
def test_commitcomment(self):
4242
comment = {'comment': load('repo_comment')}
4343
comment = github3.events._commitcomment(comment)
44-
assert isinstance(comment['comment'], github3.repos.comment.RepoComment)
44+
assert isinstance(comment['comment'],
45+
github3.repos.comment.RepoComment)
4546

4647
def test_follow(self):
4748
f = {'target': load('user')}

tests/test_gists.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import sys
2-
if sys.version_info < (3, 0):
3-
import unittest2 as unittest
4-
else:
5-
import unittest
61
import github3
72
from github3 import gists
83
from tests.utils import (BaseCase, load)
@@ -35,7 +30,8 @@ def test_create_comment(self):
3530
assert self.gist.create_comment(None) is None
3631
assert self.gist.create_comment('') is None
3732
self.not_called()
38-
assert isinstance(self.gist.create_comment('bar'), gists.comment.GistComment)
33+
assert isinstance(self.gist.create_comment('bar'),
34+
gists.comment.GistComment)
3935
self.mock_assertions()
4036

4137
def test_delete(self):

tests/test_github.py

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ def test_is_starred(self):
179179
self.response(None, 204)
180180
self.get('https://api.github.com/user/starred/user/repo')
181181

182-
self.assertRaises(github3.GitHubError, self.g.is_starred, 'user', 'repo')
182+
self.assertRaises(github3.GitHubError, self.g.is_starred,
183+
'user', 'repo')
183184

184185
self.login()
185186

@@ -193,7 +194,8 @@ def test_is_subscribed(self):
193194
self.response(None, 204)
194195
self.get('https://api.github.com/user/subscriptions/user/repo')
195196

196-
self.assertRaises(github3.GitHubError, self.g.is_subscribed, 'user', 'repo')
197+
self.assertRaises(github3.GitHubError, self.g.is_subscribed,
198+
'user', 'repo')
197199

198200
self.login()
199201
assert self.g.is_subscribed(None, None) is False
@@ -382,7 +384,8 @@ def test_iter_org_issues(self):
382384
self.get('https://api.github.com/orgs/github3py/issues')
383385
self.conf.update(params={})
384386

385-
self.assertRaises(github3.GitHubError, self.g.iter_org_issues, 'github3py')
387+
self.assertRaises(github3.GitHubError, self.g.iter_org_issues,
388+
'github3py')
386389

387390
self.login()
388391
i = next(self.g.iter_org_issues('github3py'))
@@ -412,7 +415,8 @@ def test_iter_issues(self):
412415
'sort': 'created', 'direction': 'asc',
413416
'since': '2012-05-20T23:10:27Z'}
414417
self.conf.update(params=params)
415-
assert isinstance(next(self.g.iter_issues(**params)), github3.issues.Issue)
418+
assert isinstance(next(self.g.iter_issues(**params)),
419+
github3.issues.Issue)
416420
self.mock_assertions()
417421

418422
def test_iter_user_issues(self):
@@ -423,14 +427,16 @@ def test_iter_user_issues(self):
423427
self.assertRaises(github3.GitHubError, self.g.iter_user_issues)
424428

425429
self.login()
426-
assert isinstance(next(self.g.iter_user_issues()), github3.issues.Issue)
430+
assert isinstance(next(self.g.iter_user_issues()),
431+
github3.issues.Issue)
427432
self.mock_assertions()
428433

429434
params = {'filter': 'assigned', 'state': 'closed', 'labels': 'bug',
430435
'sort': 'created', 'direction': 'asc',
431436
'since': '2012-05-20T23:10:27Z'}
432437
self.conf.update(params=params)
433-
assert isinstance(next(self.g.iter_user_issues(**params)), github3.issues.Issue)
438+
assert isinstance(next(self.g.iter_user_issues(**params)),
439+
github3.issues.Issue)
434440
self.mock_assertions()
435441

436442
def test_iter_repo_issues(self):
@@ -464,7 +470,8 @@ def test_iter_orgs(self):
464470
self.response('org', _iter=True)
465471
self.get('https://api.github.com/users/login/orgs')
466472

467-
assert isinstance(next(self.g.iter_orgs('login')), github3.orgs.Organization)
473+
assert isinstance(next(self.g.iter_orgs('login')),
474+
github3.orgs.Organization)
468475
self.mock_assertions()
469476

470477
self.get('https://api.github.com/user/orgs')
@@ -483,7 +490,8 @@ def test_iter_repos(self):
483490
assert isinstance(next(self.g.iter_repos()), github3.repos.Repository)
484491
self.mock_assertions()
485492

486-
assert isinstance(next(self.g.iter_repos('sigmavirus24')), github3.repos.Repository)
493+
assert isinstance(next(self.g.iter_repos('sigmavirus24')),
494+
github3.repos.Repository)
487495
self.mock_assertions()
488496

489497
self.conf.update(params={'type': 'all', 'direction': 'desc'})
@@ -502,7 +510,8 @@ def test_iter_user_repos(self):
502510
self.conf.update(params={"sort": "created"})
503511
self.get('https://api.github.com/users/sigmavirus24/repos')
504512

505-
assert isinstance(next(self.g.iter_user_repos('sigmavirus24', sort="created")),
513+
assert isinstance(next(self.g.iter_user_repos('sigmavirus24',
514+
sort="created")),
506515
github3.repos.Repository)
507516
self.mock_assertions()
508517

@@ -610,17 +619,19 @@ def test_pubsubhubbub(self):
610619
('hub.callback', 'https://localhost/post')]
611620
self.conf = {}
612621

613-
self.assertRaises(github3.GitHubError, self.g.pubsubhubbub, '', '', '')
622+
pubsubhubbub = self.g.pubsubhubbub
623+
624+
self.assertRaises(github3.GitHubError, pubsubhubbub, '', '', '')
614625

615626
self.login()
616-
assert self.g.pubsubhubbub('', '', '') is False
627+
assert pubsubhubbub('', '', '') is False
617628
self.not_called()
618629

619-
assert self.g.pubsubhubbub('foo', 'https://example.com', 'foo') is False
630+
assert pubsubhubbub('foo', 'https://example.com', 'foo') is False
620631
self.not_called()
621632

622633
d = dict([(k[4:], v) for k, v in body])
623-
assert self.g.pubsubhubbub(**d) is True
634+
assert pubsubhubbub(**d) is True
624635
_, kwargs = self.request.call_args
625636

626637
assert 'data' in kwargs
@@ -629,7 +640,7 @@ def test_pubsubhubbub(self):
629640

630641
d['secret'] = 'secret'
631642
body.append(('hub.secret', 'secret'))
632-
assert self.g.pubsubhubbub(**d)
643+
assert pubsubhubbub(**d)
633644
_, kwargs = self.request.call_args
634645
assert 'data' in kwargs
635646
assert body == kwargs['data']
@@ -819,7 +830,8 @@ def test_unsubscribe(self):
819830
'sigmavirus24/github3.py')
820831
self.conf = {}
821832

822-
self.assertRaises(github3.GitHubError, self.g.unsubscribe, 'foo', 'bar')
833+
self.assertRaises(github3.GitHubError, self.g.unsubscribe,
834+
'foo', 'bar')
823835

824836
self.login()
825837
assert self.g.unsubscribe(None, None) is False

tests/test_issues.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ def test_issue_137(self):
323323
self.assertEqual(i.repository, ("sigmavirus24", "github3.py"))
324324

325325

326-
327326
class TestIssueEvent(BaseCase):
328327
def setUp(self):
329328
super(TestIssueEvent, self).setUp()

tests/test_notifications.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,16 @@ def test_set_subscription(self):
4848
self.put(self.api + '/subscription')
4949
self.conf = {'data': {'subscribed': True, 'ignored': False}}
5050

51-
assert isinstance(self.thread.set_subscription(True, False), github3.notifications.Subscription)
51+
assert isinstance(self.thread.set_subscription(True, False),
52+
github3.notifications.Subscription)
5253
self.mock_assertions()
5354

5455
def test_subscription(self):
5556
self.response('subscription')
5657
self.get(self.api + '/subscription')
5758

58-
assert isinstance(self.thread.subscription(), github3.notifications.Subscription)
59+
assert isinstance(self.thread.subscription(),
60+
github3.notifications.Subscription)
5961
self.mock_assertions()
6062

6163

tests/test_orgs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ def test_remove_member(self):
336336
self.mock_assertions()
337337

338338
def test_remove_repo(self):
339-
self.assertRaises(github3.GitHubError, self.org.remove_repo, None, None)
339+
self.assertRaises(github3.GitHubError, self.org.remove_repo,
340+
None, None)
340341

341342
self.login()
342343
with patch.object(github3.orgs.Organization, 'iter_teams') as it:

0 commit comments

Comments
 (0)