Skip to content

Commit 1328ee8

Browse files
Add basic test case for preserve_formatting
1 parent 69668fd commit 1328ee8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_translate_text.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ def test_formality(translator):
184184
)
185185

186186

187+
def test_preserve_formatting(translator):
188+
# Note: this test may use the mock server that will not translate the text,
189+
# therefore we do not check the translated result.
190+
_ = translator.translate_text(
191+
example_text["EN"], target_lang="DE", preserve_formatting=True
192+
)
193+
_ = translator.translate_text(
194+
example_text["EN"], target_lang="DE", preserve_formatting=False
195+
)
196+
197+
187198
def test_split_sentences_basic(translator):
188199
text = """If the implementation is hard to explain, it's a bad idea.
189200
If the implementation is easy to explain, it may be a good idea."""

0 commit comments

Comments
 (0)