Skip to content

Commit

Permalink
Merge pull request #1716 from tseaver/1703-fix_coverage_gap
Browse files Browse the repository at this point in the history
Fix coverage gap introduced in PR #1703.
  • Loading branch information
tseaver committed Apr 11, 2016
2 parents 465976a + a6cce3f commit cefff49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gcloud/bigquery/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,8 @@ def _build_resource(self):
resource['schema'] = {
'fields': _build_schema_resource(self._schema)
}
else:
raise ValueError("Set either 'view_query' or 'schema'.")

return resource

Expand Down
9 changes: 9 additions & 0 deletions gcloud/bigquery/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,15 @@ def test_from_api_repr_w_properties(self):
self.assertTrue(table._dataset._client is client)
self._verifyResourceProperties(table, RESOURCE)

def test_create_no_view_query_no_schema(self):
conn = _Connection()
client = _Client(project=self.PROJECT, connection=conn)
dataset = _Dataset(client)
table = self._makeOne(self.TABLE_NAME, dataset)

with self.assertRaises(ValueError):
table.create()

def test_create_w_bound_client(self):
from gcloud.bigquery.table import SchemaField
PATH = 'projects/%s/datasets/%s/tables' % (self.PROJECT, self.DS_NAME)
Expand Down

0 comments on commit cefff49

Please sign in to comment.