@@ -1507,7 +1507,45 @@ def test_upload_data(self):
1507
1507
project_id = _get_project_id ())
1508
1508
1509
1509
assert result ['num_rows' ][0 ] == test_size
1510
-
1510
+
1511
+ def test_upload_chinese_unicode_data (self ):
1512
+ test_id = "2"
1513
+ test_size = 6
1514
+ df = DataFrame (np .random .randn (6 , 4 ), index = range (6 ),
1515
+ columns = list ('ABCD' ))
1516
+ df .A = u'信用卡'
1517
+
1518
+ gbq .to_gbq (df , self .destination_table + test_id , _get_project_id (),
1519
+ chunksize = 10000 )
1520
+
1521
+ result = gbq .read_gbq ("SELECT COUNT(*) AS num_rows FROM {0}" .format (
1522
+ self .destination_table + test_id ),
1523
+ project_id = _get_project_id ())
1524
+
1525
+ assert result ['num_rows' ][0 ] == test_size
1526
+ tm .assert_series_equal (result ['A' ], df ['A' ])
1527
+
1528
+ def test_upload_other_unicode_data (self ):
1529
+ test_id = "3"
1530
+ test_size = 3
1531
+ df = DataFrame ({
1532
+ 'string' : ['Skywalker™' , 'lego' , 'hülle' ],
1533
+ 'integer' : [200 , 300 , 400 ],
1534
+ 'Date' : [
1535
+ '2017-12-13 17:40:39' , '2017-12-13 17:40:39' ,
1536
+ '2017-12-13 17:40:39'
1537
+ ]
1538
+ })
1539
+
1540
+ gbq .to_gbq (df , self .destination_table + test_id , _get_project_id (),
1541
+ chunksize = 10000 )
1542
+
1543
+ result = gbq .read_gbq ("SELECT COUNT(*) AS num_rows FROM {0}" .format (
1544
+ self .destination_table + test_id ),
1545
+ project_id = _get_project_id ())
1546
+
1547
+ assert result ['num_rows' ][0 ] == test_size
1548
+ tm .assert_series_equal (result ['string' ], df ['string' ])
1511
1549
1512
1550
class TestToGBQIntegrationWithServiceAccountKeyContents (object ):
1513
1551
# Changes to BigQuery table schema may take up to 2 minutes as of May 2015
0 commit comments