8000 [QA] PEP 257 fixes to tests. · ask/python-github2@bb968da · GitHub
[go: up one dir, main page]

Skip to content

Commit bb968da

Browse files
committed
[QA] PEP 257 fixes to tests.
1 parent 01fdd82 commit bb968da

File tree

9 files changed

+44
-19
lines changed

9 files changed

+44
-19
lines changed

tests/test_commits.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212

1313
class CommitProperties(utils.HttpMockTestCase):
14-
"""Test commit property handling"""
14+
15+
"""Test commit property handling."""
16+
1517
commit_id = '1c83cde9b5a7c396a01af1007fb7b88765b9ae45'
1618

1719
def test_commit(self):
@@ -38,6 +40,7 @@ def test_repr(self):
3840

3941

4042
class CommitsQueries(utils.HttpMockTestCase):
43+
4144
"""Test commit querying"""
4245

4346
def test_list(self):

tests/test_issues.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ def test_comment_repr(self):
5252

5353

5454
class IssueQueries(utils.HttpMockTestCase):
55-
"""Test issue querying"""
55+
56+
"""Test issue querying."""
57+
5658
def test_search(self):
5759
issues = self.client.issues.search('ask/python-github2', 'timezone',
5860
'closed')

tests/test_regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
def test_issue_50():
16-
"""Erroneous init of ``Http`` with proxy setup
16+
"""Erroneous init of ``Http`` with proxy setup.
1717
1818
See https://github.com/ask/python-github2/pull/50
1919
"""

tests/test_repositories.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ def test_repr(self):
1919

2020

2121
class RepoProperties(utils.HttpMockTestCase):
22-
"""Test repository property handling"""
22+
23+
"""Test repository property handling."""
24+
2325
def test_repo(self):
2426
repo = self.client.repos.show('JNRowe/misc-overlay')
2527

tests/test_request.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def assert_params_contain(first, second):
3535

3636

3737
class TestAuthEncode(unittest.TestCase):
38-
"""Test processing of authentication data"""
38+
39+
"""Test processing of authentication data."""
40+
3941
def setUp(self):
4042
self.r = request.GithubRequest()
4143

tests/test_tz_aware_date_handling.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,20 @@
1515

1616

1717
def setup_module():
18-
"""Enable timezone-aware datetime handling for this module's tests"""
18+
"""Enable timezone-aware datetime handling for this module's tests."""
1919
core.NAIVE = False
2020

2121

2222
def teardown_module():
23-
"""Disable timezone-aware datetime handling when tests have completed"""
23+
"""Disable timezone-aware datetime handling when tests have completed."""
2424
core.NAIVE = True
2525

2626

2727
def dt_utz(year, month, day, hour, minute, second):
28-
"""Produce a UTC-anchored datetime object
28+
"""Produce a UTC-anchored datetime object.
2929
3030
:see: :class:`datetime.datetime`
31+
3132
"""
3233
return dt(year, month, day, hour, minute, second, tzinfo=tzutc())
3334

tests/test_unit.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121

2222
class ReprTests(unittest.TestCase):
23+
2324
"""__repr__ must return strings, not unicode objects."""
2425

2526
def test_issue(self):
@@ -41,9 +42,11 @@ def test_non_standard_host(self):
4142

4243

4344
class RateLimits(utils.HttpMockTestCase):
44-
"""Test API rate-limitting"""
45+
46+
"""Test API rate-limitting."""
47+
4548
def test_delays(self):
46-
"""Test call delay is at least one second"""
49+
"""Test call delay is at least one second."""
4750
client = Github(requests_per_second=.5)
4851
client.users.show('defunkt')
4952
start = datetime.datetime.utcnow()
@@ -59,15 +62,19 @@ def test_delays(self):
5962

6063

6164
class BaseDataIter(utils.HttpMockTestCase):
62-
"""Test iter availability of objects"""
65+
66+
"""Test iter availability of objects."""
67+
6368
def test_iter(self):
6469
commit_id = '1c83cde9b5a7c396a01af1007fb7b88765b9ae45'
6570
commit = self.client.commits.show('ask/python-github2', commit_id)
6671
ok_('__iter__' in dir(commit))
6772

6873

6974
class BaseDataDict(utils.HttpMockTestCase):
70-
"""Test __getitem__ availability on objects"""
75+
76+
"""Test __getitem__ availability on objects."""
77+
7178
def test_getitem(self):
7279
user = self.client.users.show('defunkt')
7380
eq_(user['blog'], user.blog)

tests/test_user.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212

1313
class UserProperties(utils.HttpMockTestCase):
14-
"""Test user property handling"""
14+
15+
"""Test user property handling."""
16+
1517
def test_user(self):
1618
user = self.client.users.show('defunkt')
1719
eq_(user.blog, 'http://chriswanstrath.com/')
@@ -43,7 +45,9 @@ def test_is_not_authenticated(self):
4345

4446

4547
class UserQueries(utils.HttpMockTestCase):
46-
"""Test user querying """
48+
49+
"""Test user querying."""
50+
4751
def test_search(self):
4852
eq_(repr(self.client.users.search('James Rowe')),
4953
'[<User: JNRowe>, <User: wooki>]')

tests/utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525

2626

2727
class HttpMock(object):
28-
"""Simple Http mock that returns saved entries
28+
"""Simple Http mock that returns saved entries.
29+
30+
Implementation tests should never span network boundaries.
2931
30-
Implementation tests should never span network boundaries
3132
"""
3233

3334
def __init__(self, cache=None, timeout=None, proxy_info=None,
@@ -55,33 +56,36 @@ def request(self, uri, method='GET', body=None, headers=None,
5556

5657
class HttpMockTestCase(unittest.TestCase):
5758
def setUp(self):
58-
"""Prepare test fixtures
59+
"""Prepare test fixtures.
5960
6061
`httplib2.Http` is patched to return cached entries via
6162
:class:`HttpMock`.
6263
6364
:attr:`client` is an unauthenticated :obj:`Github` object for easy use
6465
in tests.
66+
6567
"""
6668
httplib2.Http = HttpMock
6769
self.client = Github()
6870

6971
def tearDown(self):
70-
"""Remove test fixtures
72+
"""Remove test fixtures.
7173
7274
`httplib2.Http` is returned to its original state.
75+
7376
"""
7477
httplib2.Http = ORIG_HTTP_OBJECT
7578

7679

7780
class HttpMockAuthenticatedTestCase(HttpMockTestCase):
7881
def setUp(self):
79-
"""Prepare test fixtures
82+
"""Prepare test fixtures.
8083
8184
:see: :class:`HttpMockTestCase`
8285
8386
:attr:`client` is an authenticated :obj:`Github` object for easy use
8487
in tests.
88+
8589
"""
8690
httplib2.Http = HttpMock
8791
self.client = Github(access_token='xxx')

0 commit comments

Comments
 (0)
0