Skip to content

Commit

Permalink
Added test for validate_schema ignoring field mode when comparing sch…
Browse files Browse the repository at this point in the history
…emas
  • Loading branch information
mremes committed Feb 26, 2017
1 parent 5dafd55 commit 66aa616
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pandas_gbq/tests/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,22 @@ def test_upload_data_flexible_column_order(self):
_get_project_id(), if_exists='append',
private_key=_get_private_key_path())

def test_verify_schema_ignores_field_mode(self):
test_id = "14"
test_schema_1 = {'fields': [{'name': 'A', 'type': 'FLOAT', 'mode': 'NULLABLE'},
{'name': 'B', 'type': 'FLOAT', 'mode': 'NULLABLE'},
{'name': 'C', 'type': 'STRING', 'mode': 'NULLABLE'},
{'name': 'D', 'type': 'TIMESTAMP', 'mode': 'REQUIRED'}]}
test_schema_2 = {'fields': [{'name': 'A', 'type': 'FLOAT'},
{'name': 'B', 'type': 'FLOAT'},
{'name': 'C', 'type': 'STRING'},
{'name': 'D', 'type': 'TIMESTAMP'}]}

self.table.create(TABLE_ID + test_id, test_schema_1)
self.assertTrue(self.sut.verify_schema(
self.dataset_prefix + "1", TABLE_ID + test_id, test_schema_2),
'Expected schema to match')

def test_list_dataset(self):
dataset_id = self.dataset_prefix + "1"
self.assertTrue(dataset_id in self.dataset.datasets(),
Expand Down

0 comments on commit 66aa616

Please sign in to comment.