File tree 2 files changed +23
-2
lines changed
google/cloud/bigquery/job
2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -218,8 +218,11 @@ def job_timeout_ms(self, value):
218
218
err .__traceback__
219
219
)
220
220
221
- """ Docs indicate a string is expected by the API """
222
- self ._properties ["jobTimeoutMs" ] = str (value )
221
+ if value is not None :
222
+ # docs indicate a string is expected by the API
223
+ self ._properties ["jobTimeoutMs" ] = str (value )
224
+ else :
225
+ self ._properties .pop ("jobTimeoutMs" , None )
223
226
224
227
@property
225
228
def labels (self ):
Original file line number Diff line number Diff line change @@ -1320,3 +1320,21 @@ def test_job_timeout_ms(self):
1320
1320
# Confirm that integers get converted to strings.
1321
1321
job_config .job_timeout_ms = 5000
1322
1322
assert job_config .job_timeout_ms == "5000" # int is converted to string
1323
+
1324
+ def test_job_timeout_is_none_when_set_none (self ):
1325
+ job_config = self ._make_one ()
1326
+ job_config .job_timeout_ms = None
1327
+ # Confirm value is None and not literal string 'None'
1328
+ assert job_config .job_timeout_ms is None
1329
+
1330
+ def test_job_timeout_properties (self ):
1331
+ # Make sure any value stored in properties is erased
1332
+ # when setting job_timeout to None.
1333
+ job_config = self ._make_one ()
1334
+ job_config .job_timeout_ms = 4200
1335
+ assert job_config .job_timeout_ms == "4200"
1336
+ assert job_config ._properties .get ("jobTimeoutMs" ) == "4200"
1337
+
1338
+ job_config .job_timeout_ms = None
1339
+ assert job_config .job_timeout_ms is None
1340
+ assert "jobTimeoutMs" not in job_config ._properties
You can’t perform that action at this time.
0 commit comments