Skip to content

Commit edfdf10

Browse files
Add basic test case for tag_handling
1 parent 91aa699 commit edfdf10

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/test_translate_text.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,23 @@ def test_split_sentences_str_no_newlines(self, translator):
226226
)
227227

228228

229+
def test_tag_handling_basic(translator):
230+
text = """
231+
<!DOCTYPE html>
232+
<html>
233+
<body>
234+
<p>This is an example sentence.</p>
235+
</body>
236+
</html>
237+
"""
238+
# Note: this test may use the mock server that will not translate the text,
239+
# therefore we do not check the translated result.
240+
_ = translator.translate_text(text, target_lang="DE", tag_handling="xml")
241+
_ = translator.translate_text(text, target_lang="DE", tag_handling="html")
242+
243+
229244
@needs_real_server
230-
def test_tag_handling_specify_tags(translator):
245+
def test_tag_handling_xml(translator):
231246
text = """
232247
<document>
233248
<meta>

0 commit comments

Comments
 (0)