@@ -216,6 +216,50 @@ def test_ctor_w_schema(self):
216216 schema = [full_name , age ])
217217 self .assertEqual (table .schema , [full_name , age ])
218218
219+ def test_num_bytes_getter (self ):
220+ client = _Client (self .PROJECT )
221+ dataset = _Dataset (client )
222+ table = self ._makeOne (self .TABLE_NAME , dataset )
223+
224+ # Check with no value set.
225+ self .assertEqual (table .num_bytes , None )
226+
227+ num_bytes = 1337
228+ # Check with integer value set.
229+ table ._properties = {'numBytes' : num_bytes }
230+ self .assertEqual (table .num_bytes , num_bytes )
231+
232+ # Check with a string value set.
233+ table ._properties = {'numBytes' : str (num_bytes )}
234+ self .assertEqual (table .num_bytes , num_bytes )
235+
236+ # Check with invalid int value.
237+ table ._properties = {'numBytes' : 'x' }
238+ with self .assertRaises (ValueError ):
239+ getattr (table , 'num_bytes' )
240+
241+ def test_num_rows_getter (self ):
242+ client = _Client (self .PROJECT )
243+ dataset = _Dataset (client )
244+ table = self ._makeOne (self .TABLE_NAME , dataset )
245+
246+ # Check with no value set.
247+ self .assertEqual (table .num_rows , None )
248+
249+ num_rows = 42
250+ # Check with integer value set.
251+ table ._properties = {'numRows' : num_rows }
252+ self .assertEqual (table .num_rows , num_rows )
253+
254+ # Check with a string value set.
255+ table ._properties = {'numRows' : str (num_rows )}
256+ self .assertEqual (table .num_rows , num_rows )
257+
258+ # Check with invalid int value.
259+ table ._properties = {'numRows' : 'x' }
260+ with self .assertRaises (ValueError ):
261+ getattr (table , 'num_rows' )
262+
219263 def test_schema_setter_non_list (self ):
220264 client = _Client (self .PROJECT )
221265 dataset = _Dataset (client )
0 commit comments