@@ -73,6 +73,7 @@ def test_ctor_w_properties(target_class):
73
73
type_kind = bigquery_v2 .enums .StandardSqlDataType .TypeKind .INT64
74
74
)
75
75
type_ = "SCALAR_FUNCTION"
76
+ description = "A routine description."
76
77
77
78
actual_routine = target_class (
78
79
routine_id ,
@@ -81,6 +82,7 @@ def test_ctor_w_properties(target_class):
81
82
language = language ,
82
83
return_type = return_type ,
83
84
type_ = type_ ,
85
+ description = description ,
84
86
)
85
87
86
88
ref = RoutineReference .from_string (routine_id )
@@ -90,6 +92,7 @@ def test_ctor_w_properties(target_class):
90
92
assert actual_routine .language == language
91
93
assert actual_routine .return_type == return_type
92
94
assert actual_routine .type_ == type_
95
+ assert actual_routine .description == description
93
96
94
97
95
98
def test_from_api_repr (target_class ):
@@ -117,6 +120,7 @@ def test_from_api_repr(target_class):
117
120
"returnType" : {"typeKind" : "INT64" },
118
121
"routineType" : "SCALAR_FUNCTION" ,
119
122
"someNewField" : "someValue" ,
123
+ "description" : "A routine description." ,
120
124
}
121
125
actual_routine = target_class .from_api_repr (resource )
122
126
@@ -148,6 +152,7 @@ def test_from_api_repr(target_class):
148
152
)
149
153
assert actual_routine .type_ ==
402E
"SCALAR_FUNCTION"
150
154
assert actual_routine ._properties ["someNewField" ] == "someValue"
155
+ assert actual_routine .description == "A routine description."
151
156
152
157
153
158
def test_from_api_repr_w_minimal_resource (target_class ):
@@ -172,6 +177,7 @@ def test_from_api_repr_w_minimal_resource(target_class):
172
177
assert actual_routine .language is None
173
178
assert actual_routine .return_type is None
174
179
assert actual_routine .type_ is None
180
+ assert actual_routine .description is None
175
181
176
182
177
183
def test_from_api_repr_w_unknown_fields (target_class ):
@@ -202,6 +208,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
202
208
"language" : "SQL" ,
203
209
"returnType" : {"typeKind" : "INT64" },
204
210
"routineType" : "SCALAR_FUNCTION" ,
211
+ "description" : "A routine description." ,
205
212
},
206
213
["arguments" ],
207
214
{"arguments" : [{"name" : "x" , "dataType" : {"typeKind" : "INT64" }}]},
@@ -213,6 +220,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
213
220
"language" : "SQL" ,
214
221
"returnType" : {"typeKind" : "INT64" },
215
222
"routineType" : "SCALAR_FUNCTION" ,
223
+ "description" : "A routine description." ,
216
224
},
217
225
["body" ],
218
226
{"definitionBody" : "x * 3" },
@@ -224,6 +232,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
224
232
"language" : "SQL" ,
225
233
"returnType" : {"typeKind" : "INT64" },
226
234
"routineType" : "SCALAR_FUNCTION" ,
235
+ "description" : "A routine description." ,
227
236
},
228
237
["language" ],
229
238
{"language" : "SQL" },
@@ -235,6 +244,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
235
244
"language" : "SQL" ,
236
245
"returnType" : {"typeKind" : "INT64" },
237
246
"routineType" : "SCALAR_FUNCTION" ,
247
+ "description" : "A routine description." ,
238
248
},
239
249
["return_type" ],
240
250
{"returnType" : {"typeKind" : "INT64" }},
@@ -246,19 +256,33 @@ def test_from_api_repr_w_unknown_fields(target_class):
246
256
"language" : "SQL" ,
247
257
"returnType" : {"typeKind" : "INT64" },
248
258
"routineType" : "SCALAR_FUNCTION" ,
259
+ "description" : "A routine description." ,
249
260
},
250
261
["type_" ],
251
262
{"routineType" : "SCALAR_FUNCTION" },
252
263
),
264
+ (
265
+ {
266
+ "arguments" : [{"name" : "x" , "dataType" : {"typeKind" : "INT64" }}],
267
+ "definitionBody" : "x * 3" ,
268
+
CB92
"language" : "SQL" ,
269
+ "returnType" : {"typeKind" : "INT64" },
270
+ "routineType" : "SCALAR_FUNCTION" ,
271
+ "description" : "A routine description." ,
272
+ },
273
+ ["description" ],
274
+ {"description" : "A routine description." },
275
+ ),
253
276
(
254
277
{},
255
- ["arguments" , "language" , "body" , "type_" , "return_type" ],
278
+ ["arguments" , "language" , "body" , "type_" , "return_type" , "description" ],
256
279
{
257
280
"arguments" : None ,
258
281
"definitionBody" : None ,
259
282
"language" : None ,
260
283
"returnType" : None ,
261
284
"routineType" : None ,
285
+ "description" : None ,
262
286
},
263
287
),
264
288
(
@@ -299,6 +323,12 @@ def test_set_return_type_w_none(object_under_test):
299
323
assert object_under_test ._properties ["returnType" ] is None
300
324
301
325
326
+ def test_set_description_w_none (object_under_test ):
327
+ object_under_test .description = None
328
+ assert object_under_test .description is None
329
+ assert object_under_test ._properties ["description" ] is None
330
+
331
+
302
332
def test_repr (target_class ):
303
333
model = target_class ("my-proj.my_dset.my_routine" )
304
334
actual_routine = repr (model )
0 commit comments