Skip to content

Commit

Permalink
Update system tests for values generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
tswast committed Nov 17, 2017
1 parent fb278a4 commit d982388
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions bigquery/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def test_create_rows_then_dump_table(self):
# 8 tries -> 1 + 2 + 4 + 8 + 16 + 32 + 64 = 127 seconds
retry = RetryResult(_has_rows, max_tries=8)
rows = retry(self._fetch_single_page)(table)
row_tuples = [r.values() for r in rows]
row_tuples = [tuple(r.values()) for r in rows]
by_age = operator.itemgetter(1)
self.assertEqual(sorted(row_tuples, key=by_age),
sorted(ROWS, key=by_age))
Expand Down Expand Up @@ -396,7 +396,7 @@ def test_load_table_from_local_file_then_dump_table(self):
self.assertEqual(job.output_rows, len(ROWS))

rows = self._fetch_single_page(table)
row_tuples = [r.values() for r in rows]
row_tuples = [tuple(r.values()) for r in rows]
by_age = operator.itemgetter(1)
self.assertEqual(sorted(row_tuples, key=by_age),
sorted(ROWS, key=by_age))
Expand Down Expand Up @@ -430,7 +430,7 @@ def test_load_table_from_local_avro_file_then_dump_table(self):

table = Config.CLIENT.get_table(table)
rows = self._fetch_single_page(table)
row_tuples = [r.values() for r in rows]
row_tuples = [tuple(r.values()) for r in rows]
by_wavelength = operator.itemgetter(1)
self.assertEqual(sorted(row_tuples, key=by_wavelength),
sorted(ROWS, key=by_wavelength))
Expand Down Expand Up @@ -462,7 +462,7 @@ def test_load_table_from_uri_then_dump_table(self):
retry(job.reload)()

rows = self._fetch_single_page(table)
row_tuples = [r.values() for r in rows]
row_tuples = [tuple(r.values()) for r in rows]
by_age = operator.itemgetter(1)
self.assertEqual(sorted(row_tuples, key=by_age),
sorted(ROWS, key=by_age))
Expand Down Expand Up @@ -500,7 +500,7 @@ def test_load_table_from_uri_w_autodetect_schema_then_get_job(self):
self.assertEqual(table.schema, [field_name, field_age])

actual_rows = self._fetch_single_page(table)
actual_row_tuples = [r.values() for r in actual_rows]
actual_row_tuples = [tuple(r.values()) for r in actual_rows]
by_age = operator.itemgetter(1)
self.assertEqual(
sorted(actual_row_tuples, key=by_age), sorted(rows, key=by_age))
Expand Down Expand Up @@ -846,7 +846,7 @@ def test_dbapi_fetchall(self):
self.assertEqual(Config.CURSOR.rowcount, 3, "expected 3 rows")
Config.CURSOR.arraysize = arraysize
rows = Config.CURSOR.fetchall()
row_tuples = [r.values() for r in rows]
row_tuples = [tuple(r.values()) for r in rows]
self.assertEqual(row_tuples, [(1, 2), (3, 4), (5, 6)])

def _load_table_for_dml(self, rows, dataset_id, table_id):
Expand Down Expand Up @@ -1232,14 +1232,14 @@ def test_large_query_w_public_data(self):
def test_query_future(self):
query_job = Config.CLIENT.query('SELECT 1')
iterator = query_job.result(timeout=JOB_TIMEOUT)
row_tuples = [r.values() for r in iterator]
row_tuples = [tuple(r.values()) for r in iterator]
self.assertEqual(row_tuples, [(1,)])

def test_query_iter(self):
import types
query_job = Config.CLIENT.query('SELECT 1')
self.assertIsInstance(iter(query_job), types.GeneratorType)
row_tuples = [r.values() for r in query_job]
row_tuples = [tuple(r.values()) for r in query_job]
self.assertEqual(row_tuples, [(1,)])

def test_query_table_def(self):
Expand All @@ -1258,7 +1258,7 @@ def test_query_table_def(self):

got_rows = Config.CLIENT.query_rows(sql, job_config=job_config)

row_tuples = [r.values() for r in got_rows]
row_tuples = [tuple(r.values()) for r in got_rows]
by_age = operator.itemgetter(1)
self.assertEqual(sorted(row_tuples, key=by_age),
sorted(ROWS, key=by_age))
Expand All @@ -1282,7 +1282,7 @@ def test_query_external_table(self):

got_rows = Config.CLIENT.query_rows(sql)

row_tuples = [r.values() for r in got_rows]
row_tuples = [tuple(r.values()) for r in got_rows]
by_age = operator.itemgetter(1)
self.assertEqual(sorted(row_tuples, key=by_age),
sorted(ROWS, key=by_age))
Expand Down Expand Up @@ -1318,7 +1318,7 @@ def test_create_rows_nested_nested(self):

retry = RetryResult(_has_rows, max_tries=8)
rows = retry(self._fetch_single_page)(table)
row_tuples = [r.values() for r in rows]
row_tuples = [tuple(r.values()) for r in rows]
self.assertEqual(row_tuples, to_insert)

def test_create_rows_nested_nested_dictionary(self):
Expand Down Expand Up @@ -1352,7 +1352,7 @@ def test_create_rows_nested_nested_dictionary(self):

retry = RetryResult(_has_rows, max_tries=8)
rows = retry(self._fetch_single_page)(table)
row_tuples = [r.values() for r in rows]
row_tuples = [tuple(r.values()) for r in rows]
expected_rows = [('Some value', record)]
self.assertEqual(row_tuples, expected_rows)

Expand All @@ -1379,7 +1379,7 @@ def test_create_table_rows_fetch_nested_schema(self):

retry = RetryResult(_has_rows, max_tries=8)
fetched = retry(self._fetch_single_page)(table)
fetched_tuples = [f.values() for f in fetched]
fetched_tuples = [tuple(f.values()) for f in fetched]

self.assertEqual(len(fetched), len(to_insert))

Expand Down

0 comments on commit d982388

Please sign in to comment.