Skip to content

Commit 6f89cbf

Browse files
authored
Merge pull request #2942 from daspecster/update-import-spacing-1
Update import spacing in tests.
2 parents 602a213 + 964800f commit 6f89cbf

7 files changed

Lines changed: 77 additions & 14 deletions

File tree

packages/google-cloud-storage/unit_tests/test__helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Test_PropertyMixin(unittest.TestCase):
2020
@staticmethod
2121
def _get_target_class():
2222
from google.cloud.storage._helpers import _PropertyMixin
23+
2324
return _PropertyMixin
2425

2526
def _make_one(self, *args, **kw):
@@ -99,6 +100,7 @@ class Test__scalar_property(unittest.TestCase):
99100

100101
def _call_fut(self, fieldName):
101102
from google.cloud.storage._helpers import _scalar_property
103+
102104
return _scalar_property(fieldName)
103105

104106
def test_getter(self):
@@ -127,10 +129,12 @@ class Test__base64_md5hash(unittest.TestCase):
127129

128130
def _call_fut(self, bytes_to_sign):
129131
from google.cloud.storage._helpers import _base64_md5hash
132+
130133
return _base64_md5hash(bytes_to_sign)
131134

132135
def test_it(self):
133136
from io import BytesIO
137+
134138
BYTES_TO_SIGN = b'FOO'
135139
BUFFER = BytesIO()
136140
BUFFER.write(BYTES_TO_SIGN)

packages/google-cloud-storage/unit_tests/test__http.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class TestConnection(unittest.TestCase):
2020
@staticmethod
2121
def _get_target_class():
2222
from google.cloud.storage._http import Connection
23+
2324
return Connection
2425

2526
def _make_one(self, *args, **kw):
@@ -38,6 +39,7 @@ def test_build_api_url_no_extra_query_params(self):
3839
def test_build_api_url_w_extra_query_params(self):
3940
from six.moves.urllib.parse import parse_qsl
4041
from six.moves.urllib.parse import urlsplit
42+
4143
conn = self._make_one()
4244
uri = conn.build_api_url('/foo', {'bar': 'baz'})
4345
scheme, netloc, path, qs, _ = urlsplit(uri)

packages/google-cloud-storage/unit_tests/test_acl.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Test_ACLEntity(unittest.TestCase):
2020
@staticmethod
2121
def _get_target_class():
2222
from google.cloud.storage.acl import _ACLEntity
23+
2324
return _ACLEntity
2425

2526
def _make_one(self, *args, **kw):
@@ -130,6 +131,7 @@ class Test_ACL(unittest.TestCase):
130131
@staticmethod
131132
def _get_target_class():
132133
from google.cloud.storage.acl import ACL
134+
133135
return ACL
134136

135137
def _make_one(self, *args, **kw):
@@ -270,6 +272,7 @@ def _reload():
270272

271273
def test_has_entity_miss_entity(self):
272274
from google.cloud.storage.acl import _ACLEntity
275+
273276
TYPE = 'type'
274277
ID = 'id'
275278
entity = _ACLEntity(TYPE, ID)
@@ -310,6 +313,7 @@ def _reload():
310313

311314
def test_get_entity_miss_entity_no_default(self):
312315
from google.cloud.storage.acl import _ACLEntity
316+
313317
TYPE = 'type'
314318
ID = 'id'
315319
entity = _ACLEntity(TYPE, ID)
@@ -325,6 +329,7 @@ def test_get_entity_miss_str_w_default(self):
325329

326330
def test_get_entity_miss_entity_w_default(self):
327331
from google.cloud.storage.acl import _ACLEntity
332+
328333
DEFAULT = object()
329334
TYPE = 'type'
330335
ID = 'id'
@@ -351,6 +356,7 @@ def test_get_entity_hit_entity(self):
351356

352357
def test_add_entity_miss_eager(self):
353358
from google.cloud.storage.acl import _ACLEntity
359+
354360
TYPE = 'type'
355361
ID = 'id'
356362
ROLE = 'role'
@@ -366,6 +372,7 @@ def test_add_entity_miss_eager(self):
366372

367373
def test_add_entity_miss_lazy(self):
368374
from google.cloud.storage.acl import _ACLEntity
375+
369376
TYPE = 'type'
370377
ID = 'id'
371378
ROLE = 'role'
@@ -386,6 +393,7 @@ def _reload():
386393

387394
def test_add_entity_hit(self):
388395
from google.cloud.storage.acl import _ACLEntity
396+
389397
TYPE = 'type'
390398
ID = 'id'
391399
ENTITY_VAL = '%s-%s' % (TYPE, ID)
@@ -715,6 +723,7 @@ class Test_BucketACL(unittest.TestCase):
715723
@staticmethod
716724
def _get_target_class():
717725
from google.cloud.storage.acl import BucketACL
726+
718727
return BucketACL
719728

720729
def _make_one(self, *args, **kw):
@@ -736,6 +745,7 @@ class Test_DefaultObjectACL(unittest.TestCase):
736745
@staticmethod
737746
def _get_target_class():
738747
from google.cloud.storage.acl import DefaultObjectACL
748+
739749
return DefaultObjectACL
740750

741751
def _make_one(self, *args, **kw):
@@ -757,6 +767,7 @@ class Test_ObjectACL(unittest.TestCase):
757767
@staticmethod
758768
def _get_target_class():
759769
from google.cloud.storage.acl import ObjectACL
770+
760771
return ObjectACL
761772

762773
def _make_one(self, *args, **kw):

packages/google-cloud-storage/unit_tests/test_batch.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
def _make_credentials():
2121
import google.auth.credentials
22+
2223
return mock.Mock(spec=google.auth.credentials.Credentials)
2324

2425

@@ -27,6 +28,7 @@ class TestMIMEApplicationHTTP(unittest.TestCase):
2728
@staticmethod
2829
def _get_target_class():
2930
from google.cloud.storage.batch import MIMEApplicationHTTP
31+
3032
return MIMEApplicationHTTP
3133

3234
def _make_one(self, *args, **kw):
@@ -79,6 +81,7 @@ class TestBatch(unittest.TestCase):
7981
@staticmethod
8082
def _get_target_class():
8183
from google.cloud.storage.batch import Batch
84+
8285
return Batch
8386

8487
def _make_one(self, *args, **kw):
@@ -95,6 +98,7 @@ def test_ctor(self):
9598

9699
def test_current(self):
97100
from google.cloud.storage.client import Client
101+
98102
project = 'PROJECT'
99103
credentials = _make_credentials()
100104
client = Client(project=project, credentials=credentials)
@@ -110,6 +114,7 @@ def test_current(self):
110114

111115
def test__make_request_GET_normal(self):
112116
from google.cloud.storage.batch import _FutureDict
117+
113118
URL = 'http://example.com/api'
114119
expected = _Response()
115120
http = _HTTP((expected, ''))
@@ -136,6 +141,7 @@ def test__make_request_GET_normal(self):
136141

137142
def test__make_request_POST_normal(self):
138143
from google.cloud.storage.batch import _FutureDict
144+
139145
URL = 'http://example.com/api'
140146
http = _HTTP() # no requests expected
141147
connection = _Connection(http=http)
@@ -161,6 +167,7 @@ def test__make_request_POST_normal(self):
161167

162168
def test__make_request_PATCH_normal(self):
163169
from google.cloud.storage.batch import _FutureDict
170+
164171
URL = 'http://example.com/api'
165172
http = _HTTP() # no requests expected
166173
connection = _Connection(http=http)
@@ -186,6 +193,7 @@ def test__make_request_PATCH_normal(self):
186193

187194
def test__make_request_DELETE_normal(self):
188195
from google.cloud.storage.batch import _FutureDict
196+
189197
URL = 'http://example.com/api'
190198
http = _HTTP() # no requests expected
191199
connection = _Connection(http=http)
@@ -241,6 +249,7 @@ def _check_subrequest_no_payload(self, chunk, method, url):
241249

242250
def _check_subrequest_payload(self, chunk, method, url, payload):
243251
import json
252+
244253
lines = chunk.splitlines()
245254
# blank + 2 headers + blank + request + 2 headers + blank + body
246255
payload_str = json.dumps(payload)
@@ -262,6 +271,7 @@ def _check_subrequest_payload(self, chunk, method, url, payload):
262271

263272
def test_finish_nonempty(self):
264273
import httplib2
274+
265275
URL = 'http://api.example.com/other_api'
266276
expected = _Response()
267277
expected['content-type'] = 'multipart/mixed; boundary="DEADBEEF="'
@@ -325,6 +335,7 @@ def test_finish_responses_mismatch(self):
325335

326336
def test_finish_nonempty_with_status_failure(self):
327337
from google.cloud.exceptions import NotFound
338+
328339
URL = 'http://api.example.com/other_api'
329340
expected = _Response()
330341
expected['content-type'] = 'multipart/mixed; boundary="DEADBEEF="'
@@ -380,6 +391,7 @@ def test_finish_nonempty_non_multipart_response(self):
380391

381392
def test_as_context_mgr_wo_error(self):
382393
from google.cloud.storage.client import Client
394+
383395
URL = 'http://example.com/api'
384396
expected = _Response()
385397
expected['content-type'] = 'multipart/mixed; boundary="DEADBEEF="'
@@ -417,6 +429,7 @@ def test_as_context_mgr_wo_error(self):
417429
def test_as_context_mgr_w_error(self):
418430
from google.cloud.storage.batch import _FutureDict
419431
from google.cloud.storage.client import Client
432+
420433
URL = 'http://example.com/api'
421434
http = _HTTP()
422435
connection = _Connection(http=http)
@@ -457,10 +470,12 @@ class Test__unpack_batch_response(unittest.TestCase):
457470

458471
def _call_fut(self, response, content):
459472
from google.cloud.storage.batch import _unpack_batch_response
473+
460474
return _unpack_batch_response(response, content)
461475

462476
def _unpack_helper(self, response, content):
463477
import httplib2
478+
464479
result = list(self._call_fut(response, content))
465480
self.assertEqual(len(result), 3)
466481
response0 = httplib2.Response({
@@ -548,6 +563,7 @@ class Test__FutureDict(unittest.TestCase):
548563

549564
def _make_one(self, *args, **kw):
550565
from google.cloud.storage.batch import _FutureDict
566+
551567
return _FutureDict(*args, **kw)
552568

553569
def test_get(self):
@@ -580,14 +596,12 @@ def _make_request(self, method, url, data=None, headers=None):
580596

581597

582598
class _Response(dict):
583-
584599
def __init__(self, status=200, **kw):
585600
self.status = status
586601
super(_Response, self).__init__(**kw)
587602

588603

589604
class _HTTP(object):
590-
591605
def __init__(self, *responses):
592606
self._requests = []
593607
self._responses = list(responses)

0 commit comments

Comments
 (0)