File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 40
40
41
41
def _not_null (value , field ):
42
42
"""Check whether 'value' should be coerced to 'field' type."""
43
- return value is not None or field .mode != "NULLABLE"
43
+ return value is not None or ( field is not None and field .mode != "NULLABLE" )
44
44
45
45
46
46
def _int_from_json (value , field ):
Original file line number Diff line number Diff line change @@ -383,6 +383,16 @@ def test_from_api_repr_wo_values(self):
383
383
self .assertEqual (param .array_type , "INT64" )
384
384
self .assertEqual (param .values , [])
385
385
386
+ def test_from_api_repr_w_none_values (self ):
387
+ RESOURCE = {
388
+ "parameterType" : {"type" : "ARRAY" , "arrayType" : {"type" : "INT64" }},
389
+ "parameterValue" : {"arrayValues" : [{"value" : "1" }, {"value" : None }]},
390
+ }
391
+ klass = self ._get_target_class ()
392
+ param = klass .from_api_repr (RESOURCE )
393
+ self .assertEqual (param .array_type , "INT64" )
394
+ self .assertEqual (param .values , [1 , None ])
395
+
386
396
def test_from_api_repr_w_struct_type (self ):
387
397
from google .cloud .bigquery .query import StructQueryParameter
388
398
You can’t perform that action at this time.
0 commit comments