Tests translations of pre-prepared example texts to ensure translation is working. The texts are translations of "proton beam".
(lang, translator)
| 40 | [k for k in example_text.keys()], |
| 41 | ) |
| 42 | def test_example_translation(lang, translator): |
| 43 | """Tests translations of pre-prepared example texts to ensure translation |
| 44 | is working. |
| 45 | |
| 46 | The texts are translations of "proton beam".""" |
| 47 | |
| 48 | input_text = example_text[lang] |
| 49 | source_lang = deepl.Language.remove_regional_variant(lang) |
| 50 | result = translator.translate_text( |
| 51 | input_text, source_lang=source_lang, target_lang="EN-US" |
| 52 | ) |
| 53 | assert "proton" in result.text.lower() |
| 54 | assert result.billed_characters == len(input_text) |
| 55 | |
| 56 | |
| 57 | @needs_real_server |
nothing calls this directly
no test coverage detected