MCPcopy Create free account
hub / github.com/DeepL/deepl-python / test_glossary_translate_document

Function test_glossary_translate_document

tests/test_glossary.py:232–254  ·  view source on GitHub ↗
(
    translator,
    glossary_manager,
    example_document_path,
    output_document_path,
)

Source from the content-addressed store, hash-verified

230
231
232def test_glossary_translate_document(
233 translator,
234 glossary_manager,
235 example_document_path,
236 output_document_path,
237):
238 input_text = "artist\nprize"
239 expected_output_text = "Maler\nGewinn"
240 example_document_path.write_text(input_text)
241
242 with glossary_manager(
243 entries={"artist": "Maler", "prize": "Gewinn"},
244 source_lang="EN",
245 target_lang="DE",
246 ) as glossary:
247 translator.translate_document_from_filepath(
248 example_document_path,
249 output_path=output_document_path,
250 source_lang="EN",
251 target_lang="DE",
252 glossary=glossary,
253 )
254 assert expected_output_text == output_document_path.read_text()
255
256
257def test_glossary_translate_text_invalid(translator, glossary_manager):

Callers

nothing calls this directly

Calls 2

glossary_managerFunction · 0.85

Tested by

no test coverage detected