(
translator,
glossary_manager,
example_document_path,
output_document_path,
)
| 230 | |
| 231 | |
| 232 | def 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 | |
| 257 | def test_glossary_translate_text_invalid(translator, glossary_manager): |
nothing calls this directly
no test coverage detected