Skip to content

Commit 73d9b5a

Browse files
orionnyedandhlee
authored andcommitted
fix: 290 added a create glossary line before each call using bistro-glossary (#302)
1 parent cfe0256 commit 73d9b5a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

translation/samples/snippets/hybrid_glossaries/hybrid_tutorial_test.py

+12
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ def test_translate_standard():
5858

5959
expected_text = "Hello"
6060

61+
# attempt to create glossary, fails if it already exists
62+
languages = ["fr", "en"]
63+
glossary_name = "bistro-glossary"
64+
glossary_uri = f"gs://cloud-samples-data/translation/{glossary_name}.csv"
65+
create_glossary(languages, PROJECT_ID, glossary_name, glossary_uri)
66+
6167
text = translate_text("Bonjour", "fr", "en", PROJECT_ID, "bistro-glossary")
6268

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

77+
# attempt to create glossary, fails if it already exists
78+
languages = ["fr", "en"]
79+
glossary_name = "bistro-glossary"
80+
glossary_uri = f"gs://cloud-samples-data/translation/{glossary_name}.csv"
81+
create_glossary(languages, PROJECT_ID, glossary_name, glossary_uri)
82+
7183
text = translate_text(input_text, "fr", "en", PROJECT_ID, "bistro-glossary")
7284

7385
assert text == expected_text

0 commit comments

Comments
 (0)