@@ -1156,6 +1156,22 @@ def test_google_upload_errors_should_raise_exception(self):
1156
1156
gbq .to_gbq (bad_df , self .destination_table + test_id ,
1157
1157
_get_project_id (), private_key = _get_private_key_path ())
1158
1158
1159
+ def test_upload_unicode_data (self ):
1160
+ test_id = "1"
1161
+ test_size = 10
1162
+ df = DataFrame (np .random .randn (6 , 4 ), index = range (6 ),
1163
+ columns = list ('ABCD' ))
1164
+ df .A = u'信用卡'
1165
+
1166
+ gbq .to_gbq (df , self .destination_table + test_id , _get_project_id (),
1167
+ chunksize = 10000 )
1168
+
1169
+ result = gbq .read_gbq ("SELECT COUNT(*) AS num_rows FROM {0}" .format (
1170
+ self .destination_table + test_id ),
1171
+ project_id = _get_project_id ())
1172
+
1173
+ assert result ['num_rows' ][0 ] == test_size
1174
+
1159
1175
def test_generate_schema (self ):
1160
1176
df = tm .makeMixedDataFrame ()
1161
1177
schema = gbq ._generate_bq_schema (df )
@@ -1469,22 +1485,6 @@ def test_upload_data(self):
1469
1485
1470
1486
assert result ['num_rows' ][0 ] == test_size
1471
1487
1472
- def test_upload_unicode_data (self ):
1473
- test_id = "1"
1474
- test_size = 10
1475
- df = DataFrame (np .random .randn (6 , 4 ), index = range (6 ),
1476
- columns = list ('ABCD' ))
1477
- df .A = u'信用卡'
1478
-
1479
- gbq .to_gbq (df , self .destination_table + test_id , _get_project_id (),
1480
- chunksize = 10000 )
1481
-
1482
- result = gbq .read_gbq ("SELECT COUNT(*) AS num_rows FROM {0}" .format (
1483
- self .destination_table + test_id ),
1484
- project_id = _get_project_id ())
1485
-
1486
- assert result ['num_rows' ][0 ] == test_size
1487
-
1488
1488
1489
1489
class TestToGBQIntegrationWithServiceAccountKeyContents (object ):
1490
1490
# Changes to BigQuery table schema may take up to 2 minutes as of May 2015
0 commit comments