Skip to content

Commit 9b0ecec

Browse files
xiaozhenliu-gg5Ace Nassri
authored andcommitted
chore: cleanup synth.py (#386)
1 parent 37801fb commit 9b0ecec

24 files changed

+940
-1015
lines changed

automl/test/automlTablesDataset.v1beta1.test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ describe('Tables DatasetAPI', () => {
8484
`${cmdDataset} list-table-specs` + ` "${datasetId}" "${filter}"`
8585
);
8686
let parsedOut = output.split('\n');
87-
const outputTableId = parsedOut[1]
88-
.split(':')[1]
89-
.trim()
90-
.split('/')[7];
87+
const outputTableId = parsedOut[1].split(':')[1].trim().split('/')[7];
9188
assert.match(output, /Table Id:/);
9289

9390
// Get table
@@ -101,10 +98,7 @@ describe('Tables DatasetAPI', () => {
10198
`${cmdDataset} list-column-specs` + ` "${datasetId}" "${outputTableId}"`
10299
);
103100
parsedOut = output.split('\n');
104-
const outputColumnId = parsedOut[1]
105-
.split(':')[1]
106-
.trim()
107-
.split('/')[9];
101+
const outputColumnId = parsedOut[1].split(':')[1].trim().split('/')[9];
108102
assert.match(output, /Column Id:/);
109103

110104
// Get column

automl/test/automlTablesModel.v1beta1.test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ describe('Tables ModelAPI', () => {
4646
`${cmdModel} create-model "${datasetId}" "${tableId}" "${columnId}"` +
4747
` "${testModelName}" "${trainBudget}"`
4848
);
49-
const operationName = output
50-
.split('\n')[0]
51-
.split(':')[1]
52-
.trim();
49+
const operationName = output.split('\n')[0].split(':')[1].trim();
5350
assert.match(output, /Training started.../);
5451

5552
output = exec(`${cmdModel} get-operation-status "${operationName}"`);
@@ -112,10 +109,7 @@ describe('Tables ModelAPI', () => {
112109
it.skip('should list and get operation status', async () => {
113110
// List operations status
114111
let output = exec(`${cmdModel} list-operations-status `);
115-
const operationFullId = output
116-
.split('\n')[3]
117-
.split(':')[1]
118-
.trim();
112+
const operationFullId = output.split('\n')[3].split(':')[1].trim();
119113
assert.match(output, /Operation details:/);
120114

121115
// Get operation status

automl/test/automlTranslation.v1beta1.test.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ describe.skip('automl sample tests', () => {
3838

3939
// Create dataset
4040
output = execSync(`${cmdDataset} create-dataset -n "${testDataSetName}"`);
41-
const dataSetId = output
42-
.split('\n')[1]
43-
.split(':')[1]
44-
.trim();
41+
const dataSetId = output.split('\n')[1].split(':')[1].trim();
4542
assert.match(
4643
output,
4744
new RegExp(`Dataset display name: ${testDataSetName}`)
@@ -60,10 +57,7 @@ describe.skip('automl sample tests', () => {
6057

6158
// Create dataset
6259
output = execSync(`${cmdDataset} create-dataset -n "${dummyDataSet}"`);
63-
const dataSetId = output
64-
.split('\n')[1]
65-
.split(':')[1]
66-
.trim();
60+
const dataSetId = output.split('\n')[1].split(':')[1].trim();
6761
assert.match(output, new RegExp(`Dataset display name: ${dummyDataSet}`));
6862

6963
// Import Data
@@ -80,10 +74,7 @@ describe.skip('automl sample tests', () => {
8074
output = execSync(
8175
`${cmdModel} create-model -i "${dataSetId}" -m "${testModelName}" -t "2"`
8276
);
83-
const operationName = output
84-
.split('\n')[0]
85-
.split(':')[1]
86-
.trim();
77+
const operationName = output.split('\n')[0].split(':')[1].trim();
8778
assert.match(output, 'Training started...');
8879

8980
// Poll operation status, here confirming that operation is not complete yet

automl/test/automlVideoIntelligenceClassificationModel.v1beta1.test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ describe.skip('Video Intelligence ModelAPI', () => {
3939
let output = exec(
4040
`${cmdModel} create-model "${datasetId}" "${testModelName}"`
4141
);
42-
const operationName = output
43-
.split('\n')[0]
44-
.split(':')[1]
45-
.trim();
42+
const operationName = output.split('\n')[0].split(':')[1].trim();
4643
assert.match(output, /Training started.../);
4744

4845
output = exec(`${cmdModel} get-operation-status "${operationName}"`);
@@ -86,10 +83,7 @@ describe.skip('Video Intelligence ModelAPI', () => {
8683
it('should list and get operation status', async () => {
8784
// List operation status
8885
let output = exec(`${cmdModel} list-operations-status`);
89-
const operationFullId = output
90-
.split('\n')[3]
91-
.split(':')[1]
92-
.trim();
86+
const operationFullId = output.split('\n')[3].split(':')[1].trim();
9387
assert.match(output, /Operation details:/);
9488

9589
// Get operation status

automl/test/automlVision.test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ describe('auto ml vision', () => {
3939

4040
// Create dataset
4141
output = execSync(`${cmdDataset} create-dataset -n "${testDataSetName}"`);
42-
const dataSetId = output
43-
.split('\n')[1]
44-
.split(':')[1]
45-
.trim();
42+
const dataSetId = output.split('\n')[1].split(':')[1].trim();
4643
assert.match(output, new RegExp(testDataSetName));
4744

4845
// Delete dataset
@@ -59,10 +56,7 @@ describe('auto ml vision', () => {
5956

6057
// Create dataset
6158
output = execSync(`${cmdDataset} create-dataset -n "${dummyDataSet}"`);
62-
const dataSetId = output
63-
.split('\n')[1]
64-
.split(':')[1]
65-
.trim();
59+
const dataSetId = output.split('\n')[1].split(':')[1].trim();
6660
assert.match(output, new RegExp(dummyDataSet));
6761

6862
// Import Data

automl/test/delete-dataset.beta.test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Translate Delete Dataset Tests', () => {
3232

3333
before('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936
const request = {
4037
parent: client.locationPath(projectId, LOCATION),
4138
dataset: {

automl/test/delete_dataset.test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Translate Delete Dataset Tests', () => {
3232

3333
before('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936
const request = {
4037
parent: client.locationPath(projectId, LOCATION),
4138
dataset: {

automl/test/export_dataset.test.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('Automl Translate Dataset Tests', () => {
3333
const client = new AutoMlClient();
3434
const prefix = 'TEST_EXPORT_OUTPUT';
3535

36-
it('should export a datset', async function() {
36+
it('should export a datset', async function () {
3737
this.retries(4);
3838
await delay(this.test);
3939
const projectId = await client.getProjectId();
@@ -58,10 +58,7 @@ describe('Automl Translate Dataset Tests', () => {
5858
.getFiles(options);
5959

6060
for (const file of files) {
61-
await storageClient
62-
.bucket(`gs://${bucketName}`)
63-
.file(file.name)
64-
.delete();
61+
await storageClient.bucket(`gs://${bucketName}`).file(file.name).delete();
6562
}
6663
});
6764
});

automl/test/import_dataset.test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,11 @@ describe('Automl Import Dataset Test', () => {
6969
}
7070
}
7171

72-
it('should create a dataset', async function() {
72+
it('should create a dataset', async function () {
7373
this.retries(5);
7474
await delay(this.test);
7575
const projectId = await client.getProjectId();
76-
const displayName = `test_${uuid
77-
.v4()
78-
.replace(/-/g, '_')
79-
.substring(0, 26)}`;
76+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
8077
const request = {
8178
parent: client.locationPath(projectId, LOCATION),
8279
dataset: {
@@ -94,7 +91,7 @@ describe('Automl Import Dataset Test', () => {
9491
[response.name.split('/').length - 1].split('\n')[0];
9592
});
9693

97-
it('should import dataset', async function() {
94+
it('should import dataset', async function () {
9895
this.retries(5);
9996
await delay(this.test);
10097
const projectId = await client.getProjectId();
@@ -105,7 +102,7 @@ describe('Automl Import Dataset Test', () => {
105102
assert.match(import_output, /Dataset imported/);
106103
});
107104

108-
it('should delete created dataset', async function() {
105+
it('should delete created dataset', async function () {
109106
this.retries(5);
110107
await delay(this.test);
111108
const projectId = await client.getProjectId();

automl/test/language_entity_extraction_create_dataset.test.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ describe('Automl Natural Language Entity Extraction Create Dataset Test', () =>
3232

3333
it('should create a dataset', async () => {
3434
const projectId = await client.getProjectId();
35-
const displayName = `test_${uuid
36-
.v4()
37-
.replace(/-/g, '_')
38-
.substring(0, 26)}`;
35+
const displayName = `test_${uuid.v4().replace(/-/g, '_').substring(0, 26)}`;
3936

4037
// create
4138
const create_output = execSync(

0 commit comments

Comments
 (0)