Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix: 290 added a create glossary line before each call using bistro-g…
Browse files Browse the repository at this point in the history
…lossary (#302)
  • Loading branch information
orionnye committed Nov 23, 2021
1 parent 5abc56d commit 742e414
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions samples/snippets/hybrid_glossaries/hybrid_tutorial_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def test_translate_standard():

expected_text = "Hello"

# attempt to create glossary, fails if it already exists
languages = ["fr", "en"]
glossary_name = "bistro-glossary"
glossary_uri = f"gs://cloud-samples-data/translation/{glossary_name}.csv"
create_glossary(languages, PROJECT_ID, glossary_name, glossary_uri)

text = translate_text("Bonjour", "fr", "en", PROJECT_ID, "bistro-glossary")

assert text == expected_text
Expand All @@ -68,6 +74,12 @@ def test_translate_glossary():
expected_text = "I eat goat cheese"
input_text = "Je mange du chevre"

# attempt to create glossary, fails if it already exists
languages = ["fr", "en"]
glossary_name = "bistro-glossary"
glossary_uri = f"gs://cloud-samples-data/translation/{glossary_name}.csv"
create_glossary(languages, PROJECT_ID, glossary_name, glossary_uri)

text = translate_text(input_text, "fr", "en", PROJECT_ID, "bistro-glossary")

assert text == expected_text
Expand Down

0 comments on commit 742e414

Please sign in to comment.