Skip to content

Commit

Permalink
Add testing for defaults in from_api_repr function
Browse files Browse the repository at this point in the history
  • Loading branch information
alanbato committed Jan 17, 2018
1 parent 38e029f commit 6d16c41
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bigquery/tests/unit/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ def test_from_api_repr(self):
self.assertEqual(field.fields[0].field_type, 'INTEGER')
self.assertEqual(field.fields[0].mode, 'NULLABLE')

def test_from_api_repr_defaults(self):
field = self._get_target_class().from_api_repr({
'name': 'foo',
'type': 'record',
})
self.assertEqual(field.name, 'foo')
self.assertEqual(field.field_type, 'RECORD')
self.assertEqual(field.mode, 'NULLABLE')
self.assertEqual(len(field.fields), 0)

def test_name_property(self):
name = 'lemon-ness'
schema_field = self._make_one(name, 'INTEGER')
Expand Down

0 comments on commit 6d16c41

Please sign in to comment.