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

Function test_translate_document_formality

tests/test_translate_document.py:135–167  ·  view source on GitHub ↗
(
    translator, example_document_path, output_document_path
)

Source from the content-addressed store, hash-verified

133
134@needs_real_server
135def test_translate_document_formality(
136 translator, example_document_path, output_document_path
137):
138 example_document_path.write_text("How are you?")
139 translator.translate_document_from_filepath(
140 example_document_path,
141 output_document_path,
142 formality=deepl.Formality.MORE,
143 **default_lang_args,
144 )
145 assert "Ihnen" in output_document_path.read_text() # Wie geht es Ihnen?"
146 translator.translate_document_from_filepath(
147 example_document_path,
148 output_document_path,
149 formality=deepl.Formality.LESS,
150 **default_lang_args,
151 )
152 assert "dir" in output_document_path.read_text() # Wie geht es dir?
153 example_document_path.write_text("How are you?")
154 translator.translate_document_from_filepath(
155 example_document_path,
156 output_document_path,
157 formality=deepl.Formality.PREFER_MORE,
158 **default_lang_args,
159 )
160 assert "Ihnen" in output_document_path.read_text()
161 translator.translate_document_from_filepath(
162 example_document_path,
163 output_document_path,
164 formality=deepl.Formality.PREFER_LESS,
165 **default_lang_args,
166 )
167 assert "dir" in output_document_path.read_text()
168
169
170@needs_mock_server

Callers

nothing calls this directly

Tested by

no test coverage detected