Skip to content

Commit f25cfdc

Browse files
committed
Update import spacing part 2.
1 parent 4162351 commit f25cfdc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+646
-23
lines changed

bigquery/unit_tests/test__helpers.py

Lines changed: 55 additions & 0 deletions
Large diffs are not rendered by default.

bigquery/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.bigquery._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)

bigquery/unit_tests/test_client.py

Lines changed: 18 additions & 0 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,13 +28,15 @@ class TestClient(unittest.TestCase):
2728
@staticmethod
2829
def _get_target_class():
2930
from google.cloud.bigquery.client import Client
31+
3032
return Client
3133

3234
def _make_one(self, *args, **kw):
3335
return self._get_target_class()(*args, **kw)
3436

3537
def test_ctor(self):
3638
from google.cloud.bigquery._http import Connection
39+
3740
PROJECT = 'PROJECT'
3841
creds = _make_credentials()
3942
http = object()
@@ -45,6 +48,7 @@ def test_ctor(self):
4548
def test_list_projects_defaults(self):
4649
import six
4750
from google.cloud.bigquery.client import Project
51+
4852
PROJECT_1 = 'PROJECT_ONE'
4953
PROJECT_2 = 'PROJECT_TWO'
5054
PATH = 'projects'
@@ -115,6 +119,7 @@ def test_list_projects_explicit_response_missing_projects_key(self):
115119
def test_list_datasets_defaults(self):
116120
import six
117121
from google.cloud.bigquery.dataset import Dataset
122+
118123
PROJECT = 'PROJECT'
119124
DATASET_1 = 'dataset_one'
120125
DATASET_2 = 'dataset_two'
@@ -185,6 +190,7 @@ def test_list_datasets_explicit_response_missing_datasets_key(self):
185190

186191
def test_dataset(self):
187192
from google.cloud.bigquery.dataset import Dataset
193+
188194
PROJECT = 'PROJECT'
189195
DATASET = 'dataset_name'
190196
creds = _make_credentials()
@@ -208,6 +214,7 @@ def test_list_jobs_defaults(self):
208214
from google.cloud.bigquery.job import CopyJob
209215
from google.cloud.bigquery.job import ExtractTableToStorageJob
210216
from google.cloud.bigquery.job import QueryJob
217+
211218
PROJECT = 'PROJECT'
212219
DATASET = 'test_dataset'
213220
SOURCE_TABLE = 'source_table'
@@ -336,6 +343,7 @@ def test_list_jobs_defaults(self):
336343
def test_list_jobs_load_job_wo_sourceUris(self):
337344
import six
338345
from google.cloud.bigquery.job import LoadTableFromStorageJob
346+
339347
PROJECT = 'PROJECT'
340348
DATASET = 'test_dataset'
341349
SOURCE_TABLE = 'source_table'
@@ -391,6 +399,7 @@ def test_list_jobs_load_job_wo_sourceUris(self):
391399

392400
def test_list_jobs_explicit_missing(self):
393401
import six
402+
394403
PROJECT = 'PROJECT'
395404
PATH = 'projects/%s/jobs' % PROJECT
396405
DATA = {}
@@ -421,6 +430,7 @@ def test_list_jobs_explicit_missing(self):
421430

422431
def test_load_table_from_storage(self):
423432
from google.cloud.bigquery.job import LoadTableFromStorageJob
433+
424434
PROJECT = 'PROJECT'
425435
JOB = 'job_name'
426436
DATASET = 'dataset_name'
@@ -440,6 +450,7 @@ def test_load_table_from_storage(self):
440450

441451
def test_copy_table(self):
442452
from google.cloud.bigquery.job import CopyJob
453+
443454
PROJECT = 'PROJECT'
444455
JOB = 'job_name'
445456
DATASET = 'dataset_name'
@@ -460,6 +471,7 @@ def test_copy_table(self):
460471

461472
def test_extract_table_to_storage(self):
462473
from google.cloud.bigquery.job import ExtractTableToStorageJob
474+
463475
PROJECT = 'PROJECT'
464476
JOB = 'job_name'
465477
DATASET = 'dataset_name'
@@ -479,6 +491,7 @@ def test_extract_table_to_storage(self):
479491

480492
def test_run_async_query_defaults(self):
481493
from google.cloud.bigquery.job import QueryJob
494+
482495
PROJECT = 'PROJECT'
483496
JOB = 'job_name'
484497
QUERY = 'select count(*) from persons'
@@ -496,6 +509,7 @@ def test_run_async_query_defaults(self):
496509
def test_run_async_w_udf_resources(self):
497510
from google.cloud.bigquery._helpers import UDFResource
498511
from google.cloud.bigquery.job import QueryJob
512+
499513
RESOURCE_URI = 'gs://some-bucket/js/lib.js'
500514
PROJECT = 'PROJECT'
501515
JOB = 'job_name'
@@ -515,6 +529,7 @@ def test_run_async_w_udf_resources(self):
515529
def test_run_async_w_query_parameters(self):
516530
from google.cloud.bigquery._helpers import ScalarQueryParameter
517531
from google.cloud.bigquery.job import QueryJob
532+
518533
PROJECT = 'PROJECT'
519534
JOB = 'job_name'
520535
QUERY = 'select count(*) from persons'
@@ -533,6 +548,7 @@ def test_run_async_w_query_parameters(self):
533548

534549
def test_run_sync_query_defaults(self):
535550
from google.cloud.bigquery.query import QueryResults
551+
536552
PROJECT = 'PROJECT'
537553
QUERY = 'select count(*) from persons'
538554
creds = _make_credentials()
@@ -549,6 +565,7 @@ def test_run_sync_query_defaults(self):
549565
def test_run_sync_query_w_udf_resources(self):
550566
from google.cloud.bigquery._helpers import UDFResource
551567
from google.cloud.bigquery.query import QueryResults
568+
552569
RESOURCE_URI = 'gs://some-bucket/js/lib.js'
553570
PROJECT = 'PROJECT'
554571
QUERY = 'select count(*) from persons'
@@ -567,6 +584,7 @@ def test_run_sync_query_w_udf_resources(self):
567584
def test_run_sync_query_w_query_parameters(self):
568585
from google.cloud.bigquery._helpers import ScalarQueryParameter
569586
from google.cloud.bigquery.query import QueryResults
587+
570588
PROJECT = 'PROJECT'
571589
QUERY = 'select count(*) from persons'
572590
creds = _make_credentials()

bigquery/unit_tests/test_dataset.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class TestAccessGrant(unittest.TestCase):
2020
@staticmethod
2121
def _get_target_class():
2222
from google.cloud.bigquery.dataset import AccessGrant
23+
2324
return AccessGrant
2425

2526
def _make_one(self, *args, **kw):
@@ -84,6 +85,7 @@ class TestDataset(unittest.TestCase):
8485
@staticmethod
8586
def _get_target_class():
8687
from google.cloud.bigquery.dataset import Dataset
88+
8789
return Dataset
8890

8991
def _make_one(self, *args, **kw):
@@ -198,6 +200,7 @@ def test_ctor_defaults(self):
198200

199201
def test_ctor_explicit(self):
200202
from google.cloud.bigquery.dataset import AccessGrant
203+
201204
phred = AccessGrant('OWNER', 'userByEmail', 'phred@example.com')
202205
bharney = AccessGrant('OWNER', 'userByEmail', 'bharney@example.com')
203206
grants = [phred, bharney]
@@ -233,6 +236,7 @@ def test_access_grants_setter_non_list(self):
233236

234237
def test_access_grants_setter_invalid_field(self):
235238
from google.cloud.bigquery.dataset import AccessGrant
239+
236240
client = _Client(self.PROJECT)
237241
dataset = self._make_one(self.DS_NAME, client)
238242
phred = AccessGrant('OWNER', 'userByEmail', 'phred@example.com')
@@ -241,6 +245,7 @@ def test_access_grants_setter_invalid_field(self):
241245

242246
def test_access_grants_setter(self):
243247
from google.cloud.bigquery.dataset import AccessGrant
248+
244249
client = _Client(self.PROJECT)
245250
dataset = self._make_one(self.DS_NAME, client)
246251
phred = AccessGrant('OWNER', 'userByEmail', 'phred@example.com')
@@ -372,6 +377,7 @@ def test_create_w_bound_client(self):
372377

373378
def test_create_w_alternate_client(self):
374379
from google.cloud.bigquery.dataset import AccessGrant
380+
375381
PATH = 'projects/%s/datasets' % self.PROJECT
376382
USER_EMAIL = 'phred@example.com'
377383
GROUP_EMAIL = 'group-name@lists.example.com'
@@ -786,6 +792,7 @@ def test_list_tables_explicit(self):
786792

787793
def test_table_wo_schema(self):
788794
from google.cloud.bigquery.table import Table
795+
789796
conn = _Connection({})
790797
client = _Client(project=self.PROJECT, connection=conn)
791798
dataset = self._make_one(self.DS_NAME, client=client)
@@ -798,6 +805,7 @@ def test_table_wo_schema(self):
798805
def test_table_w_schema(self):
799806
from google.cloud.bigquery.schema import SchemaField
800807
from google.cloud.bigquery.table import Table
808+
801809
conn = _Connection({})
802810
client = _Client(project=self.PROJECT, connection=conn)
803811
dataset = self._make_one(self.DS_NAME, client=client)
@@ -825,6 +833,7 @@ def __init__(self, *responses):
825833

826834
def api_request(self, **kw):
827835
from google.cloud.exceptions import NotFound
836+
828837
self._requested.append(kw)
829838

830839
try:

bigquery/unit_tests/test_job.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class TestLoadTableFromStorageJob(unittest.TestCase, _Base):
125125
@staticmethod
126126
def _get_target_class():
127127
from google.cloud.bigquery.job import LoadTableFromStorageJob
128+
128129
return LoadTableFromStorageJob
129130

130131
def _setUpConstants(self):
@@ -264,6 +265,7 @@ def test_ctor(self):
264265

265266
def test_ctor_w_schema(self):
266267
from google.cloud.bigquery.schema import SchemaField
268+
267269
client = _Client(self.PROJECT)
268270
table = _Table()
269271
full_name = SchemaField('full_name', 'STRING', mode='REQUIRED')
@@ -281,6 +283,7 @@ def test_schema_setter_non_list(self):
281283

282284
def test_schema_setter_invalid_field(self):
283285
from google.cloud.bigquery.schema import SchemaField
286+
284287
client = _Client(self.PROJECT)
285288
table = _Table()
286289
job = self._make_one(self.JOB_NAME, table, [self.SOURCE1], client)
@@ -290,6 +293,7 @@ def test_schema_setter_invalid_field(self):
290293

291294
def test_schema_setter(self):
292295
from google.cloud.bigquery.schema import SchemaField
296+
293297
client = _Client(self.PROJECT)
294298
table = _Table()
295299
job = self._make_one(self.JOB_NAME, table, [self.SOURCE1], client)
@@ -465,6 +469,7 @@ def test_begin_w_bound_client(self):
465469

466470
def test_begin_w_alternate_client(self):
467471
from google.cloud.bigquery.schema import SchemaField
472+
468473
PATH = '/projects/%s/jobs' % (self.PROJECT,)
469474
RESOURCE = self._makeResource(ended=True)
470475
LOAD_CONFIGURATION = {
@@ -646,6 +651,7 @@ class TestCopyJob(unittest.TestCase, _Base):
646651
@staticmethod
647652
def _get_target_class():
648653
from google.cloud.bigquery.job import CopyJob
654+
649655
return CopyJob
650656

651657
def _makeResource(self, started=False, ended=False):
@@ -998,6 +1004,7 @@ class TestExtractTableToStorageJob(unittest.TestCase, _Base):
9981004
@staticmethod
9991005
def _get_target_class():
10001006
from google.cloud.bigquery.job import ExtractTableToStorageJob
1007+
10011008
return ExtractTableToStorageJob
10021009

10031010
def _makeResource(self, started=False, ended=False):
@@ -1292,6 +1299,7 @@ class TestQueryJob(unittest.TestCase, _Base):
12921299
@staticmethod
12931300
def _get_target_class():
12941301
from google.cloud.bigquery.job import QueryJob
1302+
12951303
return QueryJob
12961304

12971305
def _makeResource(self, started=False, ended=False):
@@ -1431,6 +1439,7 @@ def test_ctor_defaults(self):
14311439

14321440
def test_ctor_w_udf_resources(self):
14331441
from google.cloud.bigquery._helpers import UDFResource
1442+
14341443
RESOURCE_URI = 'gs://some-bucket/js/lib.js'
14351444
udf_resources = [UDFResource("resourceUri", RESOURCE_URI)]
14361445
client = _Client(self.PROJECT)
@@ -1440,6 +1449,7 @@ def test_ctor_w_udf_resources(self):
14401449

14411450
def test_ctor_w_query_parameters(self):
14421451
from google.cloud.bigquery._helpers import ScalarQueryParameter
1452+
14431453
query_parameters = [ScalarQueryParameter("foo", 'INT64', 123)]
14441454
client = _Client(self.PROJECT)
14451455
job = self._make_one(self.JOB_NAME, self.QUERY, client,
@@ -1501,6 +1511,7 @@ def test_from_api_repr_w_properties(self):
15011511

15021512
def test_results(self):
15031513
from google.cloud.bigquery.query import QueryResults
1514+
15041515
client = _Client(self.PROJECT)
15051516
job = self._make_one(self.JOB_NAME, self.QUERY, client)
15061517
results = job.results()
@@ -1542,6 +1553,7 @@ def test_begin_w_bound_client(self):
15421553
def test_begin_w_alternate_client(self):
15431554
from google.cloud.bigquery.dataset import Dataset
15441555
from google.cloud.bigquery.dataset import Table
1556+
15451557
PATH = '/projects/%s/jobs' % (self.PROJECT,)
15461558
TABLE = 'TABLE'
15471559
DS_NAME = 'DATASET'
@@ -1612,6 +1624,7 @@ def test_begin_w_alternate_client(self):
16121624

16131625
def test_begin_w_udf(self):
16141626
from google.cloud.bigquery._helpers import UDFResource
1627+
16151628
RESOURCE_URI = 'gs://some-bucket/js/lib.js'
16161629
INLINE_UDF_CODE = 'var someCode = "here";'
16171630
PATH = '/projects/%s/jobs' % (self.PROJECT,)
@@ -1661,6 +1674,7 @@ def test_begin_w_udf(self):
16611674

16621675
def test_begin_w_named_query_parameter(self):
16631676
from google.cloud.bigquery._helpers import ScalarQueryParameter
1677+
16641678
query_parameters = [ScalarQueryParameter('foo', 'INT64', 123)]
16651679
PATH = '/projects/%s/jobs' % (self.PROJECT,)
16661680
RESOURCE = self._makeResource()
@@ -1712,6 +1726,7 @@ def test_begin_w_named_query_parameter(self):
17121726

17131727
def test_begin_w_positional_query_parameter(self):
17141728
from google.cloud.bigquery._helpers import ScalarQueryParameter
1729+
17151730
query_parameters = [ScalarQueryParameter.positional('INT64', 123)]
17161731
PATH = '/projects/%s/jobs' % (self.PROJECT,)
17171732
RESOURCE = self._makeResource()
@@ -1794,6 +1809,7 @@ def test_exists_hit_w_alternate_client(self):
17941809
def test_reload_w_bound_client(self):
17951810
from google.cloud.bigquery.dataset import Dataset
17961811
from google.cloud.bigquery.dataset import Table
1812+
17971813
PATH = '/projects/%s/jobs/%s' % (self.PROJECT, self.JOB_NAME)
17981814
DS_NAME = 'DATASET'
17991815
DEST_TABLE = 'dest_table'
@@ -1851,6 +1867,7 @@ def __init__(self, project='project', connection=None):
18511867

18521868
def dataset(self, name):
18531869
from google.cloud.bigquery.dataset import Dataset
1870+
18541871
return Dataset(name, client=self)
18551872

18561873

@@ -1882,6 +1899,7 @@ def __init__(self, *responses):
18821899

18831900
def api_request(self, **kw):
18841901
from google.cloud.exceptions import NotFound
1902+
18851903
self._requested.append(kw)
18861904

18871905
try:

0 commit comments

Comments
 (0)