18
18
import pytest
19
19
20
20
import google .cloud ._helpers
21
+ from google .cloud import bigquery
21
22
from google .cloud import bigquery_v2
22
23
23
24
@@ -73,7 +74,7 @@ def test_ctor_w_properties(target_class):
73
74
)
74
75
type_ = "SCALAR_FUNCTION"
75
76
description = "A routine description."
76
- determinism_level = " NOT_DETERMINISTIC"
77
+ determinism_level = bigquery . DeterminismLevel . NOT_DETERMINISTIC
77
78
78
79
actual_routine = target_class (
79
80
routine_id ,
@@ -94,7 +95,9 @@ def test_ctor_w_properties(target_class):
94
95
assert actual_routine .return_type == return_type
95
96
assert actual_routine .type_ == type_
96
97
assert actual_routine .description == description
97
- assert actual_routine .determinism_level == "NOT_DETERMINISTIC"
98
+ assert (
99
+ actual_routine .determinism_level == bigquery .DeterminismLevel .NOT_DETERMINISTIC
100
+ )
98
101
99
102
100
103
def test_from_api_repr (target_class ):
@@ -123,7 +126,7 @@ def test_from_api_repr(target_class):
123
126
"routineType" : "SCALAR_FUNCTION" ,
124
127
"someNewField" : "someValue" ,
125
128
"description" : "A routine description." ,
126
- "determinismLevel" : " DETERMINISTIC" ,
129
+ "determinismLevel" : bigquery . DeterminismLevel . DETERMINISTIC ,
127
130
}
128
131
actual_routine = target_class .from_api_repr (resource )
129
132
@@ -214,7 +217,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
214
217
"returnType" : {"typeKind" : "INT64" },
215
218
"routineType" : "SCALAR_FUNCTION" ,
216
219
"description" : "A routine description." ,
217
- "determinismLevel" : " DETERMINISM_LEVEL_UNSPECIFIED" ,
220
+ "determinismLevel" : bigquery . DeterminismLevel . DETERMINISM_LEVEL_UNSPECIFIED ,
218
221
},
219
222
["arguments" ],
220
223
{"arguments" : [{"name" : "x" , "dataType" : {"typeKind" : "INT64" }}]},
@@ -227,7 +230,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
227
230
"returnType" : {"typeKind" : "INT64" },
228
231
"routineType" : "SCALAR_FUNCTION" ,
229
232
"description" : "A routine description." ,
230
- "determinismLevel" : " DETERMINISM_LEVEL_UNSPECIFIED" ,
233
+ "determinismLevel" : bigquery . DeterminismLevel . DETERMINISM_LEVEL_UNSPECIFIED ,
231
234
},
232
235
["body" ],
233
236
{"definitionBody" : "x * 3" },
@@ -240,7 +243,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
240
243
"returnType" : {"typeKind" : "INT64" },
241
244
"routineType" : "SCALAR_FUNCTION" ,
242
245
"description" : "A routine description." ,
243
- "determinismLevel" : " DETERMINISM_LEVEL_UNSPECIFIED" ,
246
+ "determinismLevel" : bigquery . DeterminismLevel . DETERMINISM_LEVEL_UNSPECIFIED ,
244
247
},
245
248
["language" ],
246
249
{"language" : "SQL" },
@@ -253,7 +256,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
253
256
"returnType" : {"typeKind" : "INT64" },
254
257
"routineType" : "SCALAR_FUNCTION" ,
255
258
"description" : "A routine description." ,
256
- "determinismLevel" : " DETERMINISM_LEVEL_UNSPECIFIED" ,
259
+ "determinismLevel" : bigquery . DeterminismLevel . DETERMINISM_LEVEL_UNSPECIFIED ,
257
260
},
258
261
["return_type" ],
259
262
{"returnType" : {"typeKind" : "INT64" }},
@@ -266,7 +269,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
266
269
"returnType" : {"typeKind" : "INT64" },
267
270
"routineType" : "SCALAR_FUNCTION" ,
268
271
"description" : "A routine description." ,
269
- "determinismLevel" : " DETERMINISM_LEVEL_UNSPECIFIED" ,
272
+ "determinismLevel" : bigquery . DeterminismLevel . DETERMINISM_LEVEL_UNSPECIFIED ,
270
273
},
271
274
["type_" ],
272
275
{"routineType" : "SCALAR_FUNCTION" },
@@ -279,7 +282,7 @@ def test_from_api_repr_w_unknown_fields(target_class):
279
282
"returnType" : {"typeKind" : "INT64" },
280
283
"routineType" : "SCALAR_FUNCTION" ,
281
284
"description" : "A routine description." ,
282
- "determinismLevel" : " DETERMINISM_LEVEL_UNSPECIFIED" ,
285
+ "determinismLevel" : bigquery . DeterminismLevel . DETERMINISM_LEVEL_UNSPECIFIED ,
283
286
},
284
287
["description" ],
285
288
{"description" : "A routine description." },
@@ -292,10 +295,12 @@ def test_from_api_repr_w_unknown_fields(target_class):
292
295
"returnType" : {"typeKind" : "INT64" },
293
296
"routineType" : "SCALAR_FUNCTION" ,
294
297
"description" : "A routine description." ,
295
- "determinismLevel" : " DETERMINISM_LEVEL_UNSPECIFIED" ,
298
+ "determinismLevel" : bigquery . DeterminismLevel . DETERMINISM_LEVEL_UNSPECIFIED ,
296
299
},
297
300
["determinism_level" ],
298
- {"determinismLevel" : "DETERMINISM_LEVEL_UNSPECIFIED" },
301
+ {
302
+ "determinismLevel" : bigquery .DeterminismLevel .DETERMINISM_LEVEL_UNSPECIFIED
303
+ },
299
304
),
300
305
(
301
306
{},
0 commit comments