@@ -73,6 +73,7 @@ def test_ctor_w_properties(target_class):
7373 type_kind = bigquery_v2 .enums .StandardSqlDataType .TypeKind .INT64
7474 )
7575 type_ = "SCALAR_FUNCTION"
76+ description = "A routine description."
7677
7778 actual_routine = target_class (
7879 routine_id ,
@@ -81,6 +82,7 @@ def test_ctor_w_properties(target_class):
8182 language = language ,
8283 return_type = return_type ,
8384 type_ = type_ ,
85+ description = description ,
8486 )
8587
8688 ref = RoutineReference .from_string (routine_id )
@@ -90,6 +92,7 @@ def test_ctor_w_properties(target_class):
9092 assert actual_routine .language == language
9193 assert actual_routine .return_type == return_type
9294 assert actual_routine .type_ == type_
95+ assert actual_routine .description == description
9396
9497
9598def test_from_api_repr (target_class ):
@@ -117,6 +120,7 @@ def test_from_api_repr(target_class):
117120 "returnType" : {"typeKind" : "INT64" },
118121 "routineType" : "SCALAR_FUNCTION" ,
119122 "someNewField" : "someValue" ,
123+ "description" : "A routine description." ,
120124 }
121125 actual_routine = target_class .from_api_repr (resource )
122126
@@ -148,6 +152,7 @@ def test_from_api_repr(target_class):
148152 )
149153 assert actual_routine .type_ == "SCALAR_FUNCTION"
150154 assert actual_routine ._properties ["someNewField" ] == "someValue"
155+ assert actual_routine .description == "A routine description."
151156
152157
153158def test_from_api_repr_w_minimal_resource (target_class ):
@@ -172,6 +177,7 @@ def test_from_api_repr_w_minimal_resource(target_class):
172177 assert actual_routine .language is None
173178 assert actual_routine .return_type is None
174179 assert actual_routine .type_ is None
180+ assert actual_routine .description is None
175181
176182
177183def test_from_api_repr_w_unknown_fields (target_class ):
@@ -202,6 +208,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
202208 "language" : "SQL" ,
203209 "returnType" : {"typeKind" : "INT64" },
204210 "routineType" : "SCALAR_FUNCTION" ,
211+ "description" : "A routine description." ,
205212 },
206213 ["arguments" ],
207214 {"arguments" : [{"name" : "x" , "dataType" : {"typeKind" : "INT64" }}]},
@@ -213,6 +220,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
213220 "language" : "SQL" ,
214221 "returnType" : {"typeKind" : "INT64" },
215222 "routineType" : "SCALAR_FUNCTION" ,
223+ "description" : "A routine description." ,
216224 },
217225 ["body" ],
218226 {"definitionBody" : "x * 3" },
@@ -224,6 +232,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
224232 "language" : "SQL" ,
225233 "returnType" : {"typeKind" : "INT64" },
226234 "routineType" : "SCALAR_FUNCTION" ,
235+ "description" : "A routine description." ,
227236 },
228237 ["language" ],
229238 {"language" : "SQL" },
@@ -235,6 +244,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
235244 "language" : "SQL" ,
236245 "returnType" : {"typeKind" : "INT64" },
237246 "routineType" : "SCALAR_FUNCTION" ,
247+ "description" : "A routine description." ,
238248 },
239249 ["return_type" ],
240250 {"returnType" : {"typeKind" : "INT64" }},
@@ -246,19 +256,33 @@ def test_from_api_repr_w_unknown_fields(target_class):
246256 "language" : "SQL" ,
247257 "returnType" : {"typeKind" : "INT64" },
248258 "routineType" : "SCALAR_FUNCTION" ,
259+ "description" : "A routine description." ,
249260 },
250261 ["type_" ],
251262 {"routineType" : "SCALAR_FUNCTION" },
252263 ),
264+ (
265+ {
266+ "arguments" : [{"name" : "x" , "dataType" : {"typeKind" : "INT64" }}],
267+ "definitionBody" : "x * 3" ,
268+ "language" : "SQL" ,
269+ "returnType" : {"typeKind" : "INT64" },
270+ "routineType" : "SCALAR_FUNCTION" ,
271+ "description" : "A routine description." ,
272+ },
273+ ["description" ],
274+ {"description" : "A routine description." },
275+ ),
253276 (
254277 {},
255- ["arguments" , "language" , "body" , "type_" , "return_type" ],
278+ ["arguments" , "language" , "body" , "type_" , "return_type" , "description" ],
256279 {
257280 "arguments" : None ,
258281 "definitionBody" : None ,
259282 "language" : None ,
260283 "returnType" : None ,
261284 "routineType" : None ,
285+ "description" : None ,
262286 },
263287 ),
264288 (
@@ -299,6 +323,12 @@ def test_set_return_type_w_none(object_under_test):
299323 assert object_under_test ._properties ["returnType" ] is None
300324
301325
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+
302332def test_repr (target_class ):
303333 model = target_class ("my-proj.my_dset.my_routine" )
304334 actual_routine = repr (model )
0 commit comments