Skip to content

Commit 4c0e776

Browse files
nnegreydanoscarmike
authored andcommitted
translate: fix tests [(#3087)](#3087)
Fix: #3018
1 parent bce98f5 commit 4c0e776

9 files changed

+8
-8
lines changed
Binary file not shown.

translation/samples/snippets/translate_v3_batch_translate_text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def batch_translate_text(
4646
output_config=output_config)
4747

4848
print(u"Waiting for operation to complete...")
49-
response = operation.result(90)
49+
response = operation.result(180)
5050

5151
print(u"Total Characters: {}".format(response.total_characters))
5252
print(u"Translated Characters: {}".format(response.translated_characters))

translation/samples/snippets/translate_v3_batch_translate_text_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
@pytest.fixture(scope="function")
2525
def bucket():
2626
"""Create a temporary bucket to store annotation output."""
27-
bucket_name = str(uuid.uuid1())
27+
bucket_name = "test-{}".format(uuid.uuid4())
2828
storage_client = storage.Client()
2929
bucket = storage_client.create_bucket(bucket_name)
3030

translation/samples/snippets/translate_v3_batch_translate_text_with_glossary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def batch_translate_text_with_glossary(
6565
)
6666

6767
print(u"Waiting for operation to complete...")
68-
response = operation.result(120)
68+
response = operation.result(180)
6969

7070
print(u"Total Characters: {}".format(response.total_characters))
7171
print(u"Translated Characters: {}".format(response.translated_characters))

translation/samples/snippets/translate_v3_batch_translate_text_with_glossary_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
@pytest.fixture(scope="session")
2828
def glossary():
2929
"""Get the ID of a glossary available to session (do not mutate/delete)."""
30-
glossary_id = "must-start-with-letters-" + str(uuid.uuid1())
30+
glossary_id = "test-{}".format(uuid.uuid4())
3131
translate_v3_create_glossary.create_glossary(
3232
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
3333
)

translation/samples/snippets/translate_v3_create_glossary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def create_glossary(
5151
# to translate the domain-specific terminology.
5252
operation = client.create_glossary(parent=parent, glossary=glossary)
5353

54-
result = operation.result(timeout=90)
54+
result = operation.result(timeout=180)
5555
print("Created: {}".format(result.name))
5656
print("Input Uri: {}".format(result.input_config.gcs_source.input_uri))
5757

translation/samples/snippets/translate_v3_create_glossary_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
def test_create_glossary(capsys):
25-
glossary_id = "must-start-with-letters-" + str(uuid.uuid1())
25+
glossary_id = "test-{}".format(uuid.uuid4())
2626
translate_v3_create_glossary.create_glossary(
2727
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
2828
)

translation/samples/snippets/translate_v3_delete_glossary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def delete_glossary(
2525
parent = client.glossary_path(project_id, "us-central1", glossary_id)
2626

2727
operation = client.delete_glossary(parent)
28-
result = operation.result(timeout=90)
28+
result = operation.result(timeout=180)
2929
print("Deleted: {}".format(result.name))
3030

3131

translation/samples/snippets/translate_v3_delete_glossary_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
def test_delete_glossary(capsys):
2525
# setup
26-
glossary_id = "must-start-with-letters-" + str(uuid.uuid1())
26+
glossary_id = "test-{}".format(uuid.uuid4())
2727
translate_v3_create_glossary.create_glossary(
2828
PROJECT_ID, GLOSSARY_INPUT_URI, glossary_id
2929
)

0 commit comments

Comments
 (0)