Skip to content

Commit 576cb65

Browse files
authored
Use explicit bytes to initialize 'BytesIO'. (googleapis#5116)
Fixes system test failures on Py3k.
1 parent d288f96 commit 576cb65

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bigquery/tests/system.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def _create_table_many_columns(self, rows):
381381
config = bigquery.LoadJobConfig()
382382
config.schema = schema
383383
job = Config.CLIENT.load_table_from_file(
384-
six.BytesIO(body), table_ref, job_config=config)
384+
six.BytesIO(body.encode('ascii')), table_ref, job_config=config)
385385
job.result()
386386
return bigquery.Table(table_ref, schema=schema)
387387

@@ -1707,7 +1707,7 @@ def test_nested_table_to_dataframe(self):
17071707
{'string_col': 'Some value', 'record_col': record},
17081708
]
17091709
rows = [json.dumps(row) for row in to_insert]
1710-
body = six.BytesIO('{}\n'.format('\n'.join(rows)))
1710+
body = six.BytesIO('{}\n'.format('\n'.join(rows)).encode('ascii'))
17111711
table_id = 'test_table'
17121712
dataset = self.temp_dataset(_make_dataset_id('nested_df'))
17131713
table = dataset.table(table_id)
@@ -1749,7 +1749,7 @@ def test_list_rows_page_size(self):
17491749
schema = [SF('string_col', 'STRING', mode='NULLABLE')]
17501750
to_insert = [{'string_col': 'item%d' % i} for i in range(num_items)]
17511751
rows = [json.dumps(row) for row in to_insert]
1752-
body = six.BytesIO('{}\n'.format('\n'.join(rows)))
1752+
body = six.BytesIO('{}\n'.format('\n'.join(rows)).encode('ascii'))
17531753

17541754
table_id = 'test_table'
17551755
dataset = self.temp_dataset(_make_dataset_id('nested_df'))

0 commit comments

Comments
 (0)