OLD | NEW |
| (Empty) |
1 library googleapis.prediction.v1_6.test; | |
2 | |
3 import "dart:core" as core; | |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | |
6 import "dart:convert" as convert; | |
7 | |
8 import 'package:http/http.dart' as http; | |
9 import 'package:http/testing.dart' as http_testing; | |
10 import 'package:unittest/unittest.dart' as unittest; | |
11 import 'package:googleapis/common/common.dart' as common; | |
12 import 'package:googleapis/src/common_internal.dart' as common_internal; | |
13 import '../common/common_internal_test.dart' as common_test; | |
14 | |
15 import 'package:googleapis/prediction/v1_6.dart' as api; | |
16 | |
17 | |
18 | |
19 core.int buildCounterAnalyzeDataDescriptionFeaturesCategoricalValues = 0; | |
20 buildAnalyzeDataDescriptionFeaturesCategoricalValues() { | |
21 var o = new api.AnalyzeDataDescriptionFeaturesCategoricalValues(); | |
22 buildCounterAnalyzeDataDescriptionFeaturesCategoricalValues++; | |
23 if (buildCounterAnalyzeDataDescriptionFeaturesCategoricalValues < 3) { | |
24 o.count = "foo"; | |
25 o.value = "foo"; | |
26 } | |
27 buildCounterAnalyzeDataDescriptionFeaturesCategoricalValues--; | |
28 return o; | |
29 } | |
30 | |
31 checkAnalyzeDataDescriptionFeaturesCategoricalValues(api.AnalyzeDataDescriptionF
eaturesCategoricalValues o) { | |
32 buildCounterAnalyzeDataDescriptionFeaturesCategoricalValues++; | |
33 if (buildCounterAnalyzeDataDescriptionFeaturesCategoricalValues < 3) { | |
34 unittest.expect(o.count, unittest.equals('foo')); | |
35 unittest.expect(o.value, unittest.equals('foo')); | |
36 } | |
37 buildCounterAnalyzeDataDescriptionFeaturesCategoricalValues--; | |
38 } | |
39 | |
40 buildUnnamed765() { | |
41 var o = new core.List<api.AnalyzeDataDescriptionFeaturesCategoricalValues>(); | |
42 o.add(buildAnalyzeDataDescriptionFeaturesCategoricalValues()); | |
43 o.add(buildAnalyzeDataDescriptionFeaturesCategoricalValues()); | |
44 return o; | |
45 } | |
46 | |
47 checkUnnamed765(core.List<api.AnalyzeDataDescriptionFeaturesCategoricalValues> o
) { | |
48 unittest.expect(o, unittest.hasLength(2)); | |
49 checkAnalyzeDataDescriptionFeaturesCategoricalValues(o[0]); | |
50 checkAnalyzeDataDescriptionFeaturesCategoricalValues(o[1]); | |
51 } | |
52 | |
53 core.int buildCounterAnalyzeDataDescriptionFeaturesCategorical = 0; | |
54 buildAnalyzeDataDescriptionFeaturesCategorical() { | |
55 var o = new api.AnalyzeDataDescriptionFeaturesCategorical(); | |
56 buildCounterAnalyzeDataDescriptionFeaturesCategorical++; | |
57 if (buildCounterAnalyzeDataDescriptionFeaturesCategorical < 3) { | |
58 o.count = "foo"; | |
59 o.values = buildUnnamed765(); | |
60 } | |
61 buildCounterAnalyzeDataDescriptionFeaturesCategorical--; | |
62 return o; | |
63 } | |
64 | |
65 checkAnalyzeDataDescriptionFeaturesCategorical(api.AnalyzeDataDescriptionFeature
sCategorical o) { | |
66 buildCounterAnalyzeDataDescriptionFeaturesCategorical++; | |
67 if (buildCounterAnalyzeDataDescriptionFeaturesCategorical < 3) { | |
68 unittest.expect(o.count, unittest.equals('foo')); | |
69 checkUnnamed765(o.values); | |
70 } | |
71 buildCounterAnalyzeDataDescriptionFeaturesCategorical--; | |
72 } | |
73 | |
74 core.int buildCounterAnalyzeDataDescriptionFeaturesNumeric = 0; | |
75 buildAnalyzeDataDescriptionFeaturesNumeric() { | |
76 var o = new api.AnalyzeDataDescriptionFeaturesNumeric(); | |
77 buildCounterAnalyzeDataDescriptionFeaturesNumeric++; | |
78 if (buildCounterAnalyzeDataDescriptionFeaturesNumeric < 3) { | |
79 o.count = "foo"; | |
80 o.mean = "foo"; | |
81 o.variance = "foo"; | |
82 } | |
83 buildCounterAnalyzeDataDescriptionFeaturesNumeric--; | |
84 return o; | |
85 } | |
86 | |
87 checkAnalyzeDataDescriptionFeaturesNumeric(api.AnalyzeDataDescriptionFeaturesNum
eric o) { | |
88 buildCounterAnalyzeDataDescriptionFeaturesNumeric++; | |
89 if (buildCounterAnalyzeDataDescriptionFeaturesNumeric < 3) { | |
90 unittest.expect(o.count, unittest.equals('foo')); | |
91 unittest.expect(o.mean, unittest.equals('foo')); | |
92 unittest.expect(o.variance, unittest.equals('foo')); | |
93 } | |
94 buildCounterAnalyzeDataDescriptionFeaturesNumeric--; | |
95 } | |
96 | |
97 core.int buildCounterAnalyzeDataDescriptionFeaturesText = 0; | |
98 buildAnalyzeDataDescriptionFeaturesText() { | |
99 var o = new api.AnalyzeDataDescriptionFeaturesText(); | |
100 buildCounterAnalyzeDataDescriptionFeaturesText++; | |
101 if (buildCounterAnalyzeDataDescriptionFeaturesText < 3) { | |
102 o.count = "foo"; | |
103 } | |
104 buildCounterAnalyzeDataDescriptionFeaturesText--; | |
105 return o; | |
106 } | |
107 | |
108 checkAnalyzeDataDescriptionFeaturesText(api.AnalyzeDataDescriptionFeaturesText o
) { | |
109 buildCounterAnalyzeDataDescriptionFeaturesText++; | |
110 if (buildCounterAnalyzeDataDescriptionFeaturesText < 3) { | |
111 unittest.expect(o.count, unittest.equals('foo')); | |
112 } | |
113 buildCounterAnalyzeDataDescriptionFeaturesText--; | |
114 } | |
115 | |
116 core.int buildCounterAnalyzeDataDescriptionFeatures = 0; | |
117 buildAnalyzeDataDescriptionFeatures() { | |
118 var o = new api.AnalyzeDataDescriptionFeatures(); | |
119 buildCounterAnalyzeDataDescriptionFeatures++; | |
120 if (buildCounterAnalyzeDataDescriptionFeatures < 3) { | |
121 o.categorical = buildAnalyzeDataDescriptionFeaturesCategorical(); | |
122 o.index = "foo"; | |
123 o.numeric = buildAnalyzeDataDescriptionFeaturesNumeric(); | |
124 o.text = buildAnalyzeDataDescriptionFeaturesText(); | |
125 } | |
126 buildCounterAnalyzeDataDescriptionFeatures--; | |
127 return o; | |
128 } | |
129 | |
130 checkAnalyzeDataDescriptionFeatures(api.AnalyzeDataDescriptionFeatures o) { | |
131 buildCounterAnalyzeDataDescriptionFeatures++; | |
132 if (buildCounterAnalyzeDataDescriptionFeatures < 3) { | |
133 checkAnalyzeDataDescriptionFeaturesCategorical(o.categorical); | |
134 unittest.expect(o.index, unittest.equals('foo')); | |
135 checkAnalyzeDataDescriptionFeaturesNumeric(o.numeric); | |
136 checkAnalyzeDataDescriptionFeaturesText(o.text); | |
137 } | |
138 buildCounterAnalyzeDataDescriptionFeatures--; | |
139 } | |
140 | |
141 buildUnnamed766() { | |
142 var o = new core.List<api.AnalyzeDataDescriptionFeatures>(); | |
143 o.add(buildAnalyzeDataDescriptionFeatures()); | |
144 o.add(buildAnalyzeDataDescriptionFeatures()); | |
145 return o; | |
146 } | |
147 | |
148 checkUnnamed766(core.List<api.AnalyzeDataDescriptionFeatures> o) { | |
149 unittest.expect(o, unittest.hasLength(2)); | |
150 checkAnalyzeDataDescriptionFeatures(o[0]); | |
151 checkAnalyzeDataDescriptionFeatures(o[1]); | |
152 } | |
153 | |
154 core.int buildCounterAnalyzeDataDescriptionOutputFeatureNumeric = 0; | |
155 buildAnalyzeDataDescriptionOutputFeatureNumeric() { | |
156 var o = new api.AnalyzeDataDescriptionOutputFeatureNumeric(); | |
157 buildCounterAnalyzeDataDescriptionOutputFeatureNumeric++; | |
158 if (buildCounterAnalyzeDataDescriptionOutputFeatureNumeric < 3) { | |
159 o.count = "foo"; | |
160 o.mean = "foo"; | |
161 o.variance = "foo"; | |
162 } | |
163 buildCounterAnalyzeDataDescriptionOutputFeatureNumeric--; | |
164 return o; | |
165 } | |
166 | |
167 checkAnalyzeDataDescriptionOutputFeatureNumeric(api.AnalyzeDataDescriptionOutput
FeatureNumeric o) { | |
168 buildCounterAnalyzeDataDescriptionOutputFeatureNumeric++; | |
169 if (buildCounterAnalyzeDataDescriptionOutputFeatureNumeric < 3) { | |
170 unittest.expect(o.count, unittest.equals('foo')); | |
171 unittest.expect(o.mean, unittest.equals('foo')); | |
172 unittest.expect(o.variance, unittest.equals('foo')); | |
173 } | |
174 buildCounterAnalyzeDataDescriptionOutputFeatureNumeric--; | |
175 } | |
176 | |
177 core.int buildCounterAnalyzeDataDescriptionOutputFeatureText = 0; | |
178 buildAnalyzeDataDescriptionOutputFeatureText() { | |
179 var o = new api.AnalyzeDataDescriptionOutputFeatureText(); | |
180 buildCounterAnalyzeDataDescriptionOutputFeatureText++; | |
181 if (buildCounterAnalyzeDataDescriptionOutputFeatureText < 3) { | |
182 o.count = "foo"; | |
183 o.value = "foo"; | |
184 } | |
185 buildCounterAnalyzeDataDescriptionOutputFeatureText--; | |
186 return o; | |
187 } | |
188 | |
189 checkAnalyzeDataDescriptionOutputFeatureText(api.AnalyzeDataDescriptionOutputFea
tureText o) { | |
190 buildCounterAnalyzeDataDescriptionOutputFeatureText++; | |
191 if (buildCounterAnalyzeDataDescriptionOutputFeatureText < 3) { | |
192 unittest.expect(o.count, unittest.equals('foo')); | |
193 unittest.expect(o.value, unittest.equals('foo')); | |
194 } | |
195 buildCounterAnalyzeDataDescriptionOutputFeatureText--; | |
196 } | |
197 | |
198 buildUnnamed767() { | |
199 var o = new core.List<api.AnalyzeDataDescriptionOutputFeatureText>(); | |
200 o.add(buildAnalyzeDataDescriptionOutputFeatureText()); | |
201 o.add(buildAnalyzeDataDescriptionOutputFeatureText()); | |
202 return o; | |
203 } | |
204 | |
205 checkUnnamed767(core.List<api.AnalyzeDataDescriptionOutputFeatureText> o) { | |
206 unittest.expect(o, unittest.hasLength(2)); | |
207 checkAnalyzeDataDescriptionOutputFeatureText(o[0]); | |
208 checkAnalyzeDataDescriptionOutputFeatureText(o[1]); | |
209 } | |
210 | |
211 core.int buildCounterAnalyzeDataDescriptionOutputFeature = 0; | |
212 buildAnalyzeDataDescriptionOutputFeature() { | |
213 var o = new api.AnalyzeDataDescriptionOutputFeature(); | |
214 buildCounterAnalyzeDataDescriptionOutputFeature++; | |
215 if (buildCounterAnalyzeDataDescriptionOutputFeature < 3) { | |
216 o.numeric = buildAnalyzeDataDescriptionOutputFeatureNumeric(); | |
217 o.text = buildUnnamed767(); | |
218 } | |
219 buildCounterAnalyzeDataDescriptionOutputFeature--; | |
220 return o; | |
221 } | |
222 | |
223 checkAnalyzeDataDescriptionOutputFeature(api.AnalyzeDataDescriptionOutputFeature
o) { | |
224 buildCounterAnalyzeDataDescriptionOutputFeature++; | |
225 if (buildCounterAnalyzeDataDescriptionOutputFeature < 3) { | |
226 checkAnalyzeDataDescriptionOutputFeatureNumeric(o.numeric); | |
227 checkUnnamed767(o.text); | |
228 } | |
229 buildCounterAnalyzeDataDescriptionOutputFeature--; | |
230 } | |
231 | |
232 core.int buildCounterAnalyzeDataDescription = 0; | |
233 buildAnalyzeDataDescription() { | |
234 var o = new api.AnalyzeDataDescription(); | |
235 buildCounterAnalyzeDataDescription++; | |
236 if (buildCounterAnalyzeDataDescription < 3) { | |
237 o.features = buildUnnamed766(); | |
238 o.outputFeature = buildAnalyzeDataDescriptionOutputFeature(); | |
239 } | |
240 buildCounterAnalyzeDataDescription--; | |
241 return o; | |
242 } | |
243 | |
244 checkAnalyzeDataDescription(api.AnalyzeDataDescription o) { | |
245 buildCounterAnalyzeDataDescription++; | |
246 if (buildCounterAnalyzeDataDescription < 3) { | |
247 checkUnnamed766(o.features); | |
248 checkAnalyzeDataDescriptionOutputFeature(o.outputFeature); | |
249 } | |
250 buildCounterAnalyzeDataDescription--; | |
251 } | |
252 | |
253 buildUnnamed768() { | |
254 var o = new core.Map<core.String, core.String>(); | |
255 o["x"] = "foo"; | |
256 o["y"] = "foo"; | |
257 return o; | |
258 } | |
259 | |
260 checkUnnamed768(core.Map<core.String, core.String> o) { | |
261 unittest.expect(o, unittest.hasLength(2)); | |
262 unittest.expect(o["x"], unittest.equals('foo')); | |
263 unittest.expect(o["y"], unittest.equals('foo')); | |
264 } | |
265 | |
266 buildUnnamed769() { | |
267 var o = new core.List<core.Map<core.String, core.String>>(); | |
268 o.add(buildUnnamed768()); | |
269 o.add(buildUnnamed768()); | |
270 return o; | |
271 } | |
272 | |
273 checkUnnamed769(core.List<core.Map<core.String, core.String>> o) { | |
274 unittest.expect(o, unittest.hasLength(2)); | |
275 checkUnnamed768(o[0]); | |
276 checkUnnamed768(o[1]); | |
277 } | |
278 | |
279 buildUnnamed770() { | |
280 var o = new core.Map<core.String, core.String>(); | |
281 o["x"] = "foo"; | |
282 o["y"] = "foo"; | |
283 return o; | |
284 } | |
285 | |
286 checkUnnamed770(core.Map<core.String, core.String> o) { | |
287 unittest.expect(o, unittest.hasLength(2)); | |
288 unittest.expect(o["x"], unittest.equals('foo')); | |
289 unittest.expect(o["y"], unittest.equals('foo')); | |
290 } | |
291 | |
292 buildUnnamed771() { | |
293 var o = new core.Map<core.String, core.Map<core.String, core.String>>(); | |
294 o["x"] = buildUnnamed770(); | |
295 o["y"] = buildUnnamed770(); | |
296 return o; | |
297 } | |
298 | |
299 checkUnnamed771(core.Map<core.String, core.Map<core.String, core.String>> o) { | |
300 unittest.expect(o, unittest.hasLength(2)); | |
301 checkUnnamed770(o["x"]); | |
302 checkUnnamed770(o["y"]); | |
303 } | |
304 | |
305 buildUnnamed772() { | |
306 var o = new core.Map<core.String, core.String>(); | |
307 o["x"] = "foo"; | |
308 o["y"] = "foo"; | |
309 return o; | |
310 } | |
311 | |
312 checkUnnamed772(core.Map<core.String, core.String> o) { | |
313 unittest.expect(o, unittest.hasLength(2)); | |
314 unittest.expect(o["x"], unittest.equals('foo')); | |
315 unittest.expect(o["y"], unittest.equals('foo')); | |
316 } | |
317 | |
318 core.int buildCounterAnalyzeModelDescription = 0; | |
319 buildAnalyzeModelDescription() { | |
320 var o = new api.AnalyzeModelDescription(); | |
321 buildCounterAnalyzeModelDescription++; | |
322 if (buildCounterAnalyzeModelDescription < 3) { | |
323 o.confusionMatrix = buildUnnamed771(); | |
324 o.confusionMatrixRowTotals = buildUnnamed772(); | |
325 o.modelinfo = buildInsert2(); | |
326 } | |
327 buildCounterAnalyzeModelDescription--; | |
328 return o; | |
329 } | |
330 | |
331 checkAnalyzeModelDescription(api.AnalyzeModelDescription o) { | |
332 buildCounterAnalyzeModelDescription++; | |
333 if (buildCounterAnalyzeModelDescription < 3) { | |
334 checkUnnamed771(o.confusionMatrix); | |
335 checkUnnamed772(o.confusionMatrixRowTotals); | |
336 checkInsert2(o.modelinfo); | |
337 } | |
338 buildCounterAnalyzeModelDescription--; | |
339 } | |
340 | |
341 core.int buildCounterAnalyze = 0; | |
342 buildAnalyze() { | |
343 var o = new api.Analyze(); | |
344 buildCounterAnalyze++; | |
345 if (buildCounterAnalyze < 3) { | |
346 o.dataDescription = buildAnalyzeDataDescription(); | |
347 o.errors = buildUnnamed769(); | |
348 o.id = "foo"; | |
349 o.kind = "foo"; | |
350 o.modelDescription = buildAnalyzeModelDescription(); | |
351 o.selfLink = "foo"; | |
352 } | |
353 buildCounterAnalyze--; | |
354 return o; | |
355 } | |
356 | |
357 checkAnalyze(api.Analyze o) { | |
358 buildCounterAnalyze++; | |
359 if (buildCounterAnalyze < 3) { | |
360 checkAnalyzeDataDescription(o.dataDescription); | |
361 checkUnnamed769(o.errors); | |
362 unittest.expect(o.id, unittest.equals('foo')); | |
363 unittest.expect(o.kind, unittest.equals('foo')); | |
364 checkAnalyzeModelDescription(o.modelDescription); | |
365 unittest.expect(o.selfLink, unittest.equals('foo')); | |
366 } | |
367 buildCounterAnalyze--; | |
368 } | |
369 | |
370 buildUnnamed773() { | |
371 var o = new core.List<core.Object>(); | |
372 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | |
373 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | |
374 return o; | |
375 } | |
376 | |
377 checkUnnamed773(core.List<core.Object> o) { | |
378 unittest.expect(o, unittest.hasLength(2)); | |
379 var casted1 = (o[0]) as core.Map; unittest.expect(casted1, unittest.hasLength(
3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], u
nittest.equals('foo')); | |
380 var casted2 = (o[1]) as core.Map; unittest.expect(casted2, unittest.hasLength(
3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], u
nittest.equals('foo')); | |
381 } | |
382 | |
383 core.int buildCounterInputInput = 0; | |
384 buildInputInput() { | |
385 var o = new api.InputInput(); | |
386 buildCounterInputInput++; | |
387 if (buildCounterInputInput < 3) { | |
388 o.csvInstance = buildUnnamed773(); | |
389 } | |
390 buildCounterInputInput--; | |
391 return o; | |
392 } | |
393 | |
394 checkInputInput(api.InputInput o) { | |
395 buildCounterInputInput++; | |
396 if (buildCounterInputInput < 3) { | |
397 checkUnnamed773(o.csvInstance); | |
398 } | |
399 buildCounterInputInput--; | |
400 } | |
401 | |
402 core.int buildCounterInput = 0; | |
403 buildInput() { | |
404 var o = new api.Input(); | |
405 buildCounterInput++; | |
406 if (buildCounterInput < 3) { | |
407 o.input = buildInputInput(); | |
408 } | |
409 buildCounterInput--; | |
410 return o; | |
411 } | |
412 | |
413 checkInput(api.Input o) { | |
414 buildCounterInput++; | |
415 if (buildCounterInput < 3) { | |
416 checkInputInput(o.input); | |
417 } | |
418 buildCounterInput--; | |
419 } | |
420 | |
421 buildUnnamed774() { | |
422 var o = new core.List<core.Object>(); | |
423 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | |
424 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | |
425 return o; | |
426 } | |
427 | |
428 checkUnnamed774(core.List<core.Object> o) { | |
429 unittest.expect(o, unittest.hasLength(2)); | |
430 var casted3 = (o[0]) as core.Map; unittest.expect(casted3, unittest.hasLength(
3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"], u
nittest.equals('foo')); | |
431 var casted4 = (o[1]) as core.Map; unittest.expect(casted4, unittest.hasLength(
3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string"], u
nittest.equals('foo')); | |
432 } | |
433 | |
434 core.int buildCounterInsertTrainingInstances = 0; | |
435 buildInsertTrainingInstances() { | |
436 var o = new api.InsertTrainingInstances(); | |
437 buildCounterInsertTrainingInstances++; | |
438 if (buildCounterInsertTrainingInstances < 3) { | |
439 o.csvInstance = buildUnnamed774(); | |
440 o.output = "foo"; | |
441 } | |
442 buildCounterInsertTrainingInstances--; | |
443 return o; | |
444 } | |
445 | |
446 checkInsertTrainingInstances(api.InsertTrainingInstances o) { | |
447 buildCounterInsertTrainingInstances++; | |
448 if (buildCounterInsertTrainingInstances < 3) { | |
449 checkUnnamed774(o.csvInstance); | |
450 unittest.expect(o.output, unittest.equals('foo')); | |
451 } | |
452 buildCounterInsertTrainingInstances--; | |
453 } | |
454 | |
455 buildUnnamed775() { | |
456 var o = new core.List<api.InsertTrainingInstances>(); | |
457 o.add(buildInsertTrainingInstances()); | |
458 o.add(buildInsertTrainingInstances()); | |
459 return o; | |
460 } | |
461 | |
462 checkUnnamed775(core.List<api.InsertTrainingInstances> o) { | |
463 unittest.expect(o, unittest.hasLength(2)); | |
464 checkInsertTrainingInstances(o[0]); | |
465 checkInsertTrainingInstances(o[1]); | |
466 } | |
467 | |
468 buildUnnamed776() { | |
469 var o = new core.Map<core.String, core.double>(); | |
470 o["x"] = 42.0; | |
471 o["y"] = 42.0; | |
472 return o; | |
473 } | |
474 | |
475 checkUnnamed776(core.Map<core.String, core.double> o) { | |
476 unittest.expect(o, unittest.hasLength(2)); | |
477 unittest.expect(o["x"], unittest.equals(42.0)); | |
478 unittest.expect(o["y"], unittest.equals(42.0)); | |
479 } | |
480 | |
481 buildUnnamed777() { | |
482 var o = new core.List<core.Map<core.String, core.double>>(); | |
483 o.add(buildUnnamed776()); | |
484 o.add(buildUnnamed776()); | |
485 return o; | |
486 } | |
487 | |
488 checkUnnamed777(core.List<core.Map<core.String, core.double>> o) { | |
489 unittest.expect(o, unittest.hasLength(2)); | |
490 checkUnnamed776(o[0]); | |
491 checkUnnamed776(o[1]); | |
492 } | |
493 | |
494 core.int buildCounterInsert = 0; | |
495 buildInsert() { | |
496 var o = new api.Insert(); | |
497 buildCounterInsert++; | |
498 if (buildCounterInsert < 3) { | |
499 o.id = "foo"; | |
500 o.modelType = "foo"; | |
501 o.sourceModel = "foo"; | |
502 o.storageDataLocation = "foo"; | |
503 o.storagePMMLLocation = "foo"; | |
504 o.storagePMMLModelLocation = "foo"; | |
505 o.trainingInstances = buildUnnamed775(); | |
506 o.utility = buildUnnamed777(); | |
507 } | |
508 buildCounterInsert--; | |
509 return o; | |
510 } | |
511 | |
512 checkInsert(api.Insert o) { | |
513 buildCounterInsert++; | |
514 if (buildCounterInsert < 3) { | |
515 unittest.expect(o.id, unittest.equals('foo')); | |
516 unittest.expect(o.modelType, unittest.equals('foo')); | |
517 unittest.expect(o.sourceModel, unittest.equals('foo')); | |
518 unittest.expect(o.storageDataLocation, unittest.equals('foo')); | |
519 unittest.expect(o.storagePMMLLocation, unittest.equals('foo')); | |
520 unittest.expect(o.storagePMMLModelLocation, unittest.equals('foo')); | |
521 checkUnnamed775(o.trainingInstances); | |
522 checkUnnamed777(o.utility); | |
523 } | |
524 buildCounterInsert--; | |
525 } | |
526 | |
527 core.int buildCounterInsert2ModelInfo = 0; | |
528 buildInsert2ModelInfo() { | |
529 var o = new api.Insert2ModelInfo(); | |
530 buildCounterInsert2ModelInfo++; | |
531 if (buildCounterInsert2ModelInfo < 3) { | |
532 o.classWeightedAccuracy = "foo"; | |
533 o.classificationAccuracy = "foo"; | |
534 o.meanSquaredError = "foo"; | |
535 o.modelType = "foo"; | |
536 o.numberInstances = "foo"; | |
537 o.numberLabels = "foo"; | |
538 } | |
539 buildCounterInsert2ModelInfo--; | |
540 return o; | |
541 } | |
542 | |
543 checkInsert2ModelInfo(api.Insert2ModelInfo o) { | |
544 buildCounterInsert2ModelInfo++; | |
545 if (buildCounterInsert2ModelInfo < 3) { | |
546 unittest.expect(o.classWeightedAccuracy, unittest.equals('foo')); | |
547 unittest.expect(o.classificationAccuracy, unittest.equals('foo')); | |
548 unittest.expect(o.meanSquaredError, unittest.equals('foo')); | |
549 unittest.expect(o.modelType, unittest.equals('foo')); | |
550 unittest.expect(o.numberInstances, unittest.equals('foo')); | |
551 unittest.expect(o.numberLabels, unittest.equals('foo')); | |
552 } | |
553 buildCounterInsert2ModelInfo--; | |
554 } | |
555 | |
556 core.int buildCounterInsert2 = 0; | |
557 buildInsert2() { | |
558 var o = new api.Insert2(); | |
559 buildCounterInsert2++; | |
560 if (buildCounterInsert2 < 3) { | |
561 o.created = core.DateTime.parse("2002-02-27T14:01:02"); | |
562 o.id = "foo"; | |
563 o.kind = "foo"; | |
564 o.modelInfo = buildInsert2ModelInfo(); | |
565 o.modelType = "foo"; | |
566 o.selfLink = "foo"; | |
567 o.storageDataLocation = "foo"; | |
568 o.storagePMMLLocation = "foo"; | |
569 o.storagePMMLModelLocation = "foo"; | |
570 o.trainingComplete = core.DateTime.parse("2002-02-27T14:01:02"); | |
571 o.trainingStatus = "foo"; | |
572 } | |
573 buildCounterInsert2--; | |
574 return o; | |
575 } | |
576 | |
577 checkInsert2(api.Insert2 o) { | |
578 buildCounterInsert2++; | |
579 if (buildCounterInsert2 < 3) { | |
580 unittest.expect(o.created, unittest.equals(core.DateTime.parse("2002-02-27T1
4:01:02"))); | |
581 unittest.expect(o.id, unittest.equals('foo')); | |
582 unittest.expect(o.kind, unittest.equals('foo')); | |
583 checkInsert2ModelInfo(o.modelInfo); | |
584 unittest.expect(o.modelType, unittest.equals('foo')); | |
585 unittest.expect(o.selfLink, unittest.equals('foo')); | |
586 unittest.expect(o.storageDataLocation, unittest.equals('foo')); | |
587 unittest.expect(o.storagePMMLLocation, unittest.equals('foo')); | |
588 unittest.expect(o.storagePMMLModelLocation, unittest.equals('foo')); | |
589 unittest.expect(o.trainingComplete, unittest.equals(core.DateTime.parse("200
2-02-27T14:01:02"))); | |
590 unittest.expect(o.trainingStatus, unittest.equals('foo')); | |
591 } | |
592 buildCounterInsert2--; | |
593 } | |
594 | |
595 buildUnnamed778() { | |
596 var o = new core.List<api.Insert2>(); | |
597 o.add(buildInsert2()); | |
598 o.add(buildInsert2()); | |
599 return o; | |
600 } | |
601 | |
602 checkUnnamed778(core.List<api.Insert2> o) { | |
603 unittest.expect(o, unittest.hasLength(2)); | |
604 checkInsert2(o[0]); | |
605 checkInsert2(o[1]); | |
606 } | |
607 | |
608 core.int buildCounterList = 0; | |
609 buildList() { | |
610 var o = new api.List(); | |
611 buildCounterList++; | |
612 if (buildCounterList < 3) { | |
613 o.items = buildUnnamed778(); | |
614 o.kind = "foo"; | |
615 o.nextPageToken = "foo"; | |
616 o.selfLink = "foo"; | |
617 } | |
618 buildCounterList--; | |
619 return o; | |
620 } | |
621 | |
622 checkList(api.List o) { | |
623 buildCounterList++; | |
624 if (buildCounterList < 3) { | |
625 checkUnnamed778(o.items); | |
626 unittest.expect(o.kind, unittest.equals('foo')); | |
627 unittest.expect(o.nextPageToken, unittest.equals('foo')); | |
628 unittest.expect(o.selfLink, unittest.equals('foo')); | |
629 } | |
630 buildCounterList--; | |
631 } | |
632 | |
633 core.int buildCounterOutputOutputMulti = 0; | |
634 buildOutputOutputMulti() { | |
635 var o = new api.OutputOutputMulti(); | |
636 buildCounterOutputOutputMulti++; | |
637 if (buildCounterOutputOutputMulti < 3) { | |
638 o.label = "foo"; | |
639 o.score = "foo"; | |
640 } | |
641 buildCounterOutputOutputMulti--; | |
642 return o; | |
643 } | |
644 | |
645 checkOutputOutputMulti(api.OutputOutputMulti o) { | |
646 buildCounterOutputOutputMulti++; | |
647 if (buildCounterOutputOutputMulti < 3) { | |
648 unittest.expect(o.label, unittest.equals('foo')); | |
649 unittest.expect(o.score, unittest.equals('foo')); | |
650 } | |
651 buildCounterOutputOutputMulti--; | |
652 } | |
653 | |
654 buildUnnamed779() { | |
655 var o = new core.List<api.OutputOutputMulti>(); | |
656 o.add(buildOutputOutputMulti()); | |
657 o.add(buildOutputOutputMulti()); | |
658 return o; | |
659 } | |
660 | |
661 checkUnnamed779(core.List<api.OutputOutputMulti> o) { | |
662 unittest.expect(o, unittest.hasLength(2)); | |
663 checkOutputOutputMulti(o[0]); | |
664 checkOutputOutputMulti(o[1]); | |
665 } | |
666 | |
667 core.int buildCounterOutput = 0; | |
668 buildOutput() { | |
669 var o = new api.Output(); | |
670 buildCounterOutput++; | |
671 if (buildCounterOutput < 3) { | |
672 o.id = "foo"; | |
673 o.kind = "foo"; | |
674 o.outputLabel = "foo"; | |
675 o.outputMulti = buildUnnamed779(); | |
676 o.outputValue = 42.0; | |
677 o.selfLink = "foo"; | |
678 } | |
679 buildCounterOutput--; | |
680 return o; | |
681 } | |
682 | |
683 checkOutput(api.Output o) { | |
684 buildCounterOutput++; | |
685 if (buildCounterOutput < 3) { | |
686 unittest.expect(o.id, unittest.equals('foo')); | |
687 unittest.expect(o.kind, unittest.equals('foo')); | |
688 unittest.expect(o.outputLabel, unittest.equals('foo')); | |
689 checkUnnamed779(o.outputMulti); | |
690 unittest.expect(o.outputValue, unittest.equals(42.0)); | |
691 unittest.expect(o.selfLink, unittest.equals('foo')); | |
692 } | |
693 buildCounterOutput--; | |
694 } | |
695 | |
696 buildUnnamed780() { | |
697 var o = new core.List<core.Object>(); | |
698 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | |
699 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | |
700 return o; | |
701 } | |
702 | |
703 checkUnnamed780(core.List<core.Object> o) { | |
704 unittest.expect(o, unittest.hasLength(2)); | |
705 var casted5 = (o[0]) as core.Map; unittest.expect(casted5, unittest.hasLength(
3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["string"], u
nittest.equals('foo')); | |
706 var casted6 = (o[1]) as core.Map; unittest.expect(casted6, unittest.hasLength(
3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["string"], u
nittest.equals('foo')); | |
707 } | |
708 | |
709 core.int buildCounterUpdate = 0; | |
710 buildUpdate() { | |
711 var o = new api.Update(); | |
712 buildCounterUpdate++; | |
713 if (buildCounterUpdate < 3) { | |
714 o.csvInstance = buildUnnamed780(); | |
715 o.output = "foo"; | |
716 } | |
717 buildCounterUpdate--; | |
718 return o; | |
719 } | |
720 | |
721 checkUpdate(api.Update o) { | |
722 buildCounterUpdate++; | |
723 if (buildCounterUpdate < 3) { | |
724 checkUnnamed780(o.csvInstance); | |
725 unittest.expect(o.output, unittest.equals('foo')); | |
726 } | |
727 buildCounterUpdate--; | |
728 } | |
729 | |
730 | |
731 main() { | |
732 unittest.group("obj-schema-AnalyzeDataDescriptionFeaturesCategoricalValues", (
) { | |
733 unittest.test("to-json--from-json", () { | |
734 var o = buildAnalyzeDataDescriptionFeaturesCategoricalValues(); | |
735 var od = new api.AnalyzeDataDescriptionFeaturesCategoricalValues.fromJson(
o.toJson()); | |
736 checkAnalyzeDataDescriptionFeaturesCategoricalValues(od); | |
737 }); | |
738 }); | |
739 | |
740 | |
741 unittest.group("obj-schema-AnalyzeDataDescriptionFeaturesCategorical", () { | |
742 unittest.test("to-json--from-json", () { | |
743 var o = buildAnalyzeDataDescriptionFeaturesCategorical(); | |
744 var od = new api.AnalyzeDataDescriptionFeaturesCategorical.fromJson(o.toJs
on()); | |
745 checkAnalyzeDataDescriptionFeaturesCategorical(od); | |
746 }); | |
747 }); | |
748 | |
749 | |
750 unittest.group("obj-schema-AnalyzeDataDescriptionFeaturesNumeric", () { | |
751 unittest.test("to-json--from-json", () { | |
752 var o = buildAnalyzeDataDescriptionFeaturesNumeric(); | |
753 var od = new api.AnalyzeDataDescriptionFeaturesNumeric.fromJson(o.toJson()
); | |
754 checkAnalyzeDataDescriptionFeaturesNumeric(od); | |
755 }); | |
756 }); | |
757 | |
758 | |
759 unittest.group("obj-schema-AnalyzeDataDescriptionFeaturesText", () { | |
760 unittest.test("to-json--from-json", () { | |
761 var o = buildAnalyzeDataDescriptionFeaturesText(); | |
762 var od = new api.AnalyzeDataDescriptionFeaturesText.fromJson(o.toJson()); | |
763 checkAnalyzeDataDescriptionFeaturesText(od); | |
764 }); | |
765 }); | |
766 | |
767 | |
768 unittest.group("obj-schema-AnalyzeDataDescriptionFeatures", () { | |
769 unittest.test("to-json--from-json", () { | |
770 var o = buildAnalyzeDataDescriptionFeatures(); | |
771 var od = new api.AnalyzeDataDescriptionFeatures.fromJson(o.toJson()); | |
772 checkAnalyzeDataDescriptionFeatures(od); | |
773 }); | |
774 }); | |
775 | |
776 | |
777 unittest.group("obj-schema-AnalyzeDataDescriptionOutputFeatureNumeric", () { | |
778 unittest.test("to-json--from-json", () { | |
779 var o = buildAnalyzeDataDescriptionOutputFeatureNumeric(); | |
780 var od = new api.AnalyzeDataDescriptionOutputFeatureNumeric.fromJson(o.toJ
son()); | |
781 checkAnalyzeDataDescriptionOutputFeatureNumeric(od); | |
782 }); | |
783 }); | |
784 | |
785 | |
786 unittest.group("obj-schema-AnalyzeDataDescriptionOutputFeatureText", () { | |
787 unittest.test("to-json--from-json", () { | |
788 var o = buildAnalyzeDataDescriptionOutputFeatureText(); | |
789 var od = new api.AnalyzeDataDescriptionOutputFeatureText.fromJson(o.toJson
()); | |
790 checkAnalyzeDataDescriptionOutputFeatureText(od); | |
791 }); | |
792 }); | |
793 | |
794 | |
795 unittest.group("obj-schema-AnalyzeDataDescriptionOutputFeature", () { | |
796 unittest.test("to-json--from-json", () { | |
797 var o = buildAnalyzeDataDescriptionOutputFeature(); | |
798 var od = new api.AnalyzeDataDescriptionOutputFeature.fromJson(o.toJson()); | |
799 checkAnalyzeDataDescriptionOutputFeature(od); | |
800 }); | |
801 }); | |
802 | |
803 | |
804 unittest.group("obj-schema-AnalyzeDataDescription", () { | |
805 unittest.test("to-json--from-json", () { | |
806 var o = buildAnalyzeDataDescription(); | |
807 var od = new api.AnalyzeDataDescription.fromJson(o.toJson()); | |
808 checkAnalyzeDataDescription(od); | |
809 }); | |
810 }); | |
811 | |
812 | |
813 unittest.group("obj-schema-AnalyzeModelDescription", () { | |
814 unittest.test("to-json--from-json", () { | |
815 var o = buildAnalyzeModelDescription(); | |
816 var od = new api.AnalyzeModelDescription.fromJson(o.toJson()); | |
817 checkAnalyzeModelDescription(od); | |
818 }); | |
819 }); | |
820 | |
821 | |
822 unittest.group("obj-schema-Analyze", () { | |
823 unittest.test("to-json--from-json", () { | |
824 var o = buildAnalyze(); | |
825 var od = new api.Analyze.fromJson(o.toJson()); | |
826 checkAnalyze(od); | |
827 }); | |
828 }); | |
829 | |
830 | |
831 unittest.group("obj-schema-InputInput", () { | |
832 unittest.test("to-json--from-json", () { | |
833 var o = buildInputInput(); | |
834 var od = new api.InputInput.fromJson(o.toJson()); | |
835 checkInputInput(od); | |
836 }); | |
837 }); | |
838 | |
839 | |
840 unittest.group("obj-schema-Input", () { | |
841 unittest.test("to-json--from-json", () { | |
842 var o = buildInput(); | |
843 var od = new api.Input.fromJson(o.toJson()); | |
844 checkInput(od); | |
845 }); | |
846 }); | |
847 | |
848 | |
849 unittest.group("obj-schema-InsertTrainingInstances", () { | |
850 unittest.test("to-json--from-json", () { | |
851 var o = buildInsertTrainingInstances(); | |
852 var od = new api.InsertTrainingInstances.fromJson(o.toJson()); | |
853 checkInsertTrainingInstances(od); | |
854 }); | |
855 }); | |
856 | |
857 | |
858 unittest.group("obj-schema-Insert", () { | |
859 unittest.test("to-json--from-json", () { | |
860 var o = buildInsert(); | |
861 var od = new api.Insert.fromJson(o.toJson()); | |
862 checkInsert(od); | |
863 }); | |
864 }); | |
865 | |
866 | |
867 unittest.group("obj-schema-Insert2ModelInfo", () { | |
868 unittest.test("to-json--from-json", () { | |
869 var o = buildInsert2ModelInfo(); | |
870 var od = new api.Insert2ModelInfo.fromJson(o.toJson()); | |
871 checkInsert2ModelInfo(od); | |
872 }); | |
873 }); | |
874 | |
875 | |
876 unittest.group("obj-schema-Insert2", () { | |
877 unittest.test("to-json--from-json", () { | |
878 var o = buildInsert2(); | |
879 var od = new api.Insert2.fromJson(o.toJson()); | |
880 checkInsert2(od); | |
881 }); | |
882 }); | |
883 | |
884 | |
885 unittest.group("obj-schema-List", () { | |
886 unittest.test("to-json--from-json", () { | |
887 var o = buildList(); | |
888 var od = new api.List.fromJson(o.toJson()); | |
889 checkList(od); | |
890 }); | |
891 }); | |
892 | |
893 | |
894 unittest.group("obj-schema-OutputOutputMulti", () { | |
895 unittest.test("to-json--from-json", () { | |
896 var o = buildOutputOutputMulti(); | |
897 var od = new api.OutputOutputMulti.fromJson(o.toJson()); | |
898 checkOutputOutputMulti(od); | |
899 }); | |
900 }); | |
901 | |
902 | |
903 unittest.group("obj-schema-Output", () { | |
904 unittest.test("to-json--from-json", () { | |
905 var o = buildOutput(); | |
906 var od = new api.Output.fromJson(o.toJson()); | |
907 checkOutput(od); | |
908 }); | |
909 }); | |
910 | |
911 | |
912 unittest.group("obj-schema-Update", () { | |
913 unittest.test("to-json--from-json", () { | |
914 var o = buildUpdate(); | |
915 var od = new api.Update.fromJson(o.toJson()); | |
916 checkUpdate(od); | |
917 }); | |
918 }); | |
919 | |
920 | |
921 unittest.group("resource-HostedmodelsResourceApi", () { | |
922 unittest.test("method--predict", () { | |
923 | |
924 var mock = new common_test.HttpServerMock(); | |
925 api.HostedmodelsResourceApi res = new api.PredictionApi(mock).hostedmodels
; | |
926 var arg_request = buildInput(); | |
927 var arg_project = "foo"; | |
928 var arg_hostedModelName = "foo"; | |
929 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
930 var obj = new api.Input.fromJson(json); | |
931 checkInput(obj); | |
932 | |
933 var path = (req.url).path; | |
934 var pathOffset = 0; | |
935 var index; | |
936 var subPart; | |
937 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/prediction/v1.6/projects/")); | |
938 pathOffset += 26; | |
939 index = path.indexOf("/hostedmodels/", pathOffset); | |
940 unittest.expect(index >= 0, unittest.isTrue); | |
941 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
942 pathOffset = index; | |
943 unittest.expect(subPart, unittest.equals("$arg_project")); | |
944 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/hostedmodels/")); | |
945 pathOffset += 14; | |
946 index = path.indexOf("/predict", pathOffset); | |
947 unittest.expect(index >= 0, unittest.isTrue); | |
948 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
949 pathOffset = index; | |
950 unittest.expect(subPart, unittest.equals("$arg_hostedModelName")); | |
951 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/predict")); | |
952 pathOffset += 8; | |
953 | |
954 var query = (req.url).query; | |
955 var queryOffset = 0; | |
956 var queryMap = {}; | |
957 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
958 parseBool(n) { | |
959 if (n == "true") return true; | |
960 if (n == "false") return false; | |
961 if (n == null) return null; | |
962 throw new core.ArgumentError("Invalid boolean: $n"); | |
963 } | |
964 if (query.length > 0) { | |
965 for (var part in query.split("&")) { | |
966 var keyvalue = part.split("="); | |
967 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
968 } | |
969 } | |
970 | |
971 | |
972 var h = { | |
973 "content-type" : "application/json; charset=utf-8", | |
974 }; | |
975 var resp = convert.JSON.encode(buildOutput()); | |
976 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
977 }), true); | |
978 res.predict(arg_request, arg_project, arg_hostedModelName).then(unittest.e
xpectAsync(((api.Output response) { | |
979 checkOutput(response); | |
980 }))); | |
981 }); | |
982 | |
983 }); | |
984 | |
985 | |
986 unittest.group("resource-TrainedmodelsResourceApi", () { | |
987 unittest.test("method--analyze", () { | |
988 | |
989 var mock = new common_test.HttpServerMock(); | |
990 api.TrainedmodelsResourceApi res = new api.PredictionApi(mock).trainedmode
ls; | |
991 var arg_project = "foo"; | |
992 var arg_id = "foo"; | |
993 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
994 var path = (req.url).path; | |
995 var pathOffset = 0; | |
996 var index; | |
997 var subPart; | |
998 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/prediction/v1.6/projects/")); | |
999 pathOffset += 26; | |
1000 index = path.indexOf("/trainedmodels/", pathOffset); | |
1001 unittest.expect(index >= 0, unittest.isTrue); | |
1002 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1003 pathOffset = index; | |
1004 unittest.expect(subPart, unittest.equals("$arg_project")); | |
1005 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/trainedmodels/")); | |
1006 pathOffset += 15; | |
1007 index = path.indexOf("/analyze", pathOffset); | |
1008 unittest.expect(index >= 0, unittest.isTrue); | |
1009 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1010 pathOffset = index; | |
1011 unittest.expect(subPart, unittest.equals("$arg_id")); | |
1012 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/analyze")); | |
1013 pathOffset += 8; | |
1014 | |
1015 var query = (req.url).query; | |
1016 var queryOffset = 0; | |
1017 var queryMap = {}; | |
1018 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1019 parseBool(n) { | |
1020 if (n == "true") return true; | |
1021 if (n == "false") return false; | |
1022 if (n == null) return null; | |
1023 throw new core.ArgumentError("Invalid boolean: $n"); | |
1024 } | |
1025 if (query.length > 0) { | |
1026 for (var part in query.split("&")) { | |
1027 var keyvalue = part.split("="); | |
1028 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1029 } | |
1030 } | |
1031 | |
1032 | |
1033 var h = { | |
1034 "content-type" : "application/json; charset=utf-8", | |
1035 }; | |
1036 var resp = convert.JSON.encode(buildAnalyze()); | |
1037 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1038 }), true); | |
1039 res.analyze(arg_project, arg_id).then(unittest.expectAsync(((api.Analyze r
esponse) { | |
1040 checkAnalyze(response); | |
1041 }))); | |
1042 }); | |
1043 | |
1044 unittest.test("method--delete", () { | |
1045 | |
1046 var mock = new common_test.HttpServerMock(); | |
1047 api.TrainedmodelsResourceApi res = new api.PredictionApi(mock).trainedmode
ls; | |
1048 var arg_project = "foo"; | |
1049 var arg_id = "foo"; | |
1050 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1051 var path = (req.url).path; | |
1052 var pathOffset = 0; | |
1053 var index; | |
1054 var subPart; | |
1055 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/prediction/v1.6/projects/")); | |
1056 pathOffset += 26; | |
1057 index = path.indexOf("/trainedmodels/", pathOffset); | |
1058 unittest.expect(index >= 0, unittest.isTrue); | |
1059 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1060 pathOffset = index; | |
1061 unittest.expect(subPart, unittest.equals("$arg_project")); | |
1062 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/trainedmodels/")); | |
1063 pathOffset += 15; | |
1064 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1065 pathOffset = path.length; | |
1066 unittest.expect(subPart, unittest.equals("$arg_id")); | |
1067 | |
1068 var query = (req.url).query; | |
1069 var queryOffset = 0; | |
1070 var queryMap = {}; | |
1071 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1072 parseBool(n) { | |
1073 if (n == "true") return true; | |
1074 if (n == "false") return false; | |
1075 if (n == null) return null; | |
1076 throw new core.ArgumentError("Invalid boolean: $n"); | |
1077 } | |
1078 if (query.length > 0) { | |
1079 for (var part in query.split("&")) { | |
1080 var keyvalue = part.split("="); | |
1081 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1082 } | |
1083 } | |
1084 | |
1085 | |
1086 var h = { | |
1087 "content-type" : "application/json; charset=utf-8", | |
1088 }; | |
1089 var resp = ""; | |
1090 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1091 }), true); | |
1092 res.delete(arg_project, arg_id).then(unittest.expectAsync((_) {})); | |
1093 }); | |
1094 | |
1095 unittest.test("method--get", () { | |
1096 | |
1097 var mock = new common_test.HttpServerMock(); | |
1098 api.TrainedmodelsResourceApi res = new api.PredictionApi(mock).trainedmode
ls; | |
1099 var arg_project = "foo"; | |
1100 var arg_id = "foo"; | |
1101 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1102 var path = (req.url).path; | |
1103 var pathOffset = 0; | |
1104 var index; | |
1105 var subPart; | |
1106 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/prediction/v1.6/projects/")); | |
1107 pathOffset += 26; | |
1108 index = path.indexOf("/trainedmodels/", pathOffset); | |
1109 unittest.expect(index >= 0, unittest.isTrue); | |
1110 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1111 pathOffset = index; | |
1112 unittest.expect(subPart, unittest.equals("$arg_project")); | |
1113 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/trainedmodels/")); | |
1114 pathOffset += 15; | |
1115 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1116 pathOffset = path.length; | |
1117 unittest.expect(subPart, unittest.equals("$arg_id")); | |
1118 | |
1119 var query = (req.url).query; | |
1120 var queryOffset = 0; | |
1121 var queryMap = {}; | |
1122 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1123 parseBool(n) { | |
1124 if (n == "true") return true; | |
1125 if (n == "false") return false; | |
1126 if (n == null) return null; | |
1127 throw new core.ArgumentError("Invalid boolean: $n"); | |
1128 } | |
1129 if (query.length > 0) { | |
1130 for (var part in query.split("&")) { | |
1131 var keyvalue = part.split("="); | |
1132 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1133 } | |
1134 } | |
1135 | |
1136 | |
1137 var h = { | |
1138 "content-type" : "application/json; charset=utf-8", | |
1139 }; | |
1140 var resp = convert.JSON.encode(buildInsert2()); | |
1141 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1142 }), true); | |
1143 res.get(arg_project, arg_id).then(unittest.expectAsync(((api.Insert2 respo
nse) { | |
1144 checkInsert2(response); | |
1145 }))); | |
1146 }); | |
1147 | |
1148 unittest.test("method--insert", () { | |
1149 | |
1150 var mock = new common_test.HttpServerMock(); | |
1151 api.TrainedmodelsResourceApi res = new api.PredictionApi(mock).trainedmode
ls; | |
1152 var arg_request = buildInsert(); | |
1153 var arg_project = "foo"; | |
1154 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1155 var obj = new api.Insert.fromJson(json); | |
1156 checkInsert(obj); | |
1157 | |
1158 var path = (req.url).path; | |
1159 var pathOffset = 0; | |
1160 var index; | |
1161 var subPart; | |
1162 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/prediction/v1.6/projects/")); | |
1163 pathOffset += 26; | |
1164 index = path.indexOf("/trainedmodels", pathOffset); | |
1165 unittest.expect(index >= 0, unittest.isTrue); | |
1166 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1167 pathOffset = index; | |
1168 unittest.expect(subPart, unittest.equals("$arg_project")); | |
1169 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/trainedmodels")); | |
1170 pathOffset += 14; | |
1171 | |
1172 var query = (req.url).query; | |
1173 var queryOffset = 0; | |
1174 var queryMap = {}; | |
1175 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1176 parseBool(n) { | |
1177 if (n == "true") return true; | |
1178 if (n == "false") return false; | |
1179 if (n == null) return null; | |
1180 throw new core.ArgumentError("Invalid boolean: $n"); | |
1181 } | |
1182 if (query.length > 0) { | |
1183 for (var part in query.split("&")) { | |
1184 var keyvalue = part.split("="); | |
1185 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1186 } | |
1187 } | |
1188 | |
1189 | |
1190 var h = { | |
1191 "content-type" : "application/json; charset=utf-8", | |
1192 }; | |
1193 var resp = convert.JSON.encode(buildInsert2()); | |
1194 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1195 }), true); | |
1196 res.insert(arg_request, arg_project).then(unittest.expectAsync(((api.Inser
t2 response) { | |
1197 checkInsert2(response); | |
1198 }))); | |
1199 }); | |
1200 | |
1201 unittest.test("method--list", () { | |
1202 | |
1203 var mock = new common_test.HttpServerMock(); | |
1204 api.TrainedmodelsResourceApi res = new api.PredictionApi(mock).trainedmode
ls; | |
1205 var arg_project = "foo"; | |
1206 var arg_maxResults = 42; | |
1207 var arg_pageToken = "foo"; | |
1208 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1209 var path = (req.url).path; | |
1210 var pathOffset = 0; | |
1211 var index; | |
1212 var subPart; | |
1213 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/prediction/v1.6/projects/")); | |
1214 pathOffset += 26; | |
1215 index = path.indexOf("/trainedmodels/list", pathOffset); | |
1216 unittest.expect(index >= 0, unittest.isTrue); | |
1217 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1218 pathOffset = index; | |
1219 unittest.expect(subPart, unittest.equals("$arg_project")); | |
1220 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("/trainedmodels/list")); | |
1221 pathOffset += 19; | |
1222 | |
1223 var query = (req.url).query; | |
1224 var queryOffset = 0; | |
1225 var queryMap = {}; | |
1226 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1227 parseBool(n) { | |
1228 if (n == "true") return true; | |
1229 if (n == "false") return false; | |
1230 if (n == null) return null; | |
1231 throw new core.ArgumentError("Invalid boolean: $n"); | |
1232 } | |
1233 if (query.length > 0) { | |
1234 for (var part in query.split("&")) { | |
1235 var keyvalue = part.split("="); | |
1236 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1237 } | |
1238 } | |
1239 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | |
1240 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1241 | |
1242 | |
1243 var h = { | |
1244 "content-type" : "application/json; charset=utf-8", | |
1245 }; | |
1246 var resp = convert.JSON.encode(buildList()); | |
1247 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1248 }), true); | |
1249 res.list(arg_project, maxResults: arg_maxResults, pageToken: arg_pageToken
).then(unittest.expectAsync(((api.List response) { | |
1250 checkList(response); | |
1251 }))); | |
1252 }); | |
1253 | |
1254 unittest.test("method--predict", () { | |
1255 | |
1256 var mock = new common_test.HttpServerMock(); | |
1257 api.TrainedmodelsResourceApi res = new api.PredictionApi(mock).trainedmode
ls; | |
1258 var arg_request = buildInput(); | |
1259 var arg_project = "foo"; | |
1260 var arg_id = "foo"; | |
1261 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1262 var obj = new api.Input.fromJson(json); | |
1263 checkInput(obj); | |
1264 | |
1265 var path = (req.url).path; | |
1266 var pathOffset = 0; | |
1267 var index; | |
1268 var subPart; | |
1269 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/prediction/v1.6/projects/")); | |
1270 pathOffset += 26; | |
1271 index = path.indexOf("/trainedmodels/", pathOffset); | |
1272 unittest.expect(index >= 0, unittest.isTrue); | |
1273 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1274 pathOffset = index; | |
1275 unittest.expect(subPart, unittest.equals("$arg_project")); | |
1276 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/trainedmodels/")); | |
1277 pathOffset += 15; | |
1278 index = path.indexOf("/predict", pathOffset); | |
1279 unittest.expect(index >= 0, unittest.isTrue); | |
1280 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1281 pathOffset = index; | |
1282 unittest.expect(subPart, unittest.equals("$arg_id")); | |
1283 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/predict")); | |
1284 pathOffset += 8; | |
1285 | |
1286 var query = (req.url).query; | |
1287 var queryOffset = 0; | |
1288 var queryMap = {}; | |
1289 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1290 parseBool(n) { | |
1291 if (n == "true") return true; | |
1292 if (n == "false") return false; | |
1293 if (n == null) return null; | |
1294 throw new core.ArgumentError("Invalid boolean: $n"); | |
1295 } | |
1296 if (query.length > 0) { | |
1297 for (var part in query.split("&")) { | |
1298 var keyvalue = part.split("="); | |
1299 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1300 } | |
1301 } | |
1302 | |
1303 | |
1304 var h = { | |
1305 "content-type" : "application/json; charset=utf-8", | |
1306 }; | |
1307 var resp = convert.JSON.encode(buildOutput()); | |
1308 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1309 }), true); | |
1310 res.predict(arg_request, arg_project, arg_id).then(unittest.expectAsync(((
api.Output response) { | |
1311 checkOutput(response); | |
1312 }))); | |
1313 }); | |
1314 | |
1315 unittest.test("method--update", () { | |
1316 | |
1317 var mock = new common_test.HttpServerMock(); | |
1318 api.TrainedmodelsResourceApi res = new api.PredictionApi(mock).trainedmode
ls; | |
1319 var arg_request = buildUpdate(); | |
1320 var arg_project = "foo"; | |
1321 var arg_id = "foo"; | |
1322 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1323 var obj = new api.Update.fromJson(json); | |
1324 checkUpdate(obj); | |
1325 | |
1326 var path = (req.url).path; | |
1327 var pathOffset = 0; | |
1328 var index; | |
1329 var subPart; | |
1330 unittest.expect(path.substring(pathOffset, pathOffset + 26), unittest.eq
uals("/prediction/v1.6/projects/")); | |
1331 pathOffset += 26; | |
1332 index = path.indexOf("/trainedmodels/", pathOffset); | |
1333 unittest.expect(index >= 0, unittest.isTrue); | |
1334 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | |
1335 pathOffset = index; | |
1336 unittest.expect(subPart, unittest.equals("$arg_project")); | |
1337 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("/trainedmodels/")); | |
1338 pathOffset += 15; | |
1339 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | |
1340 pathOffset = path.length; | |
1341 unittest.expect(subPart, unittest.equals("$arg_id")); | |
1342 | |
1343 var query = (req.url).query; | |
1344 var queryOffset = 0; | |
1345 var queryMap = {}; | |
1346 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1347 parseBool(n) { | |
1348 if (n == "true") return true; | |
1349 if (n == "false") return false; | |
1350 if (n == null) return null; | |
1351 throw new core.ArgumentError("Invalid boolean: $n"); | |
1352 } | |
1353 if (query.length > 0) { | |
1354 for (var part in query.split("&")) { | |
1355 var keyvalue = part.split("="); | |
1356 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1357 } | |
1358 } | |
1359 | |
1360 | |
1361 var h = { | |
1362 "content-type" : "application/json; charset=utf-8", | |
1363 }; | |
1364 var resp = convert.JSON.encode(buildInsert2()); | |
1365 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
1366 }), true); | |
1367 res.update(arg_request, arg_project, arg_id).then(unittest.expectAsync(((a
pi.Insert2 response) { | |
1368 checkInsert2(response); | |
1369 }))); | |
1370 }); | |
1371 | |
1372 }); | |
1373 | |
1374 | |
1375 } | |
1376 | |
OLD | NEW |