Skip to content

Commit ae01a28

Browse files
test: add test for CLI text options
1 parent f761732 commit ae01a28

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/test_cli.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,37 @@ def test_text(runner):
9494
assert example_text["DE"] in result.output
9595
assert "Detected source" in result.output
9696

97+
# Test text options
98+
extra_options = [
99+
("--formality more", "'formality': 'more'"),
100+
("--split-sentences 0", "'split_sentences': '0'"),
101+
("--preserve-formatting", "'preserve_formatting': '1'"),
102+
("--tag-handling xml", "'tag_handling': 'xml'"),
103+
("--outline-detection-off", "'outline_detection': '0'"),
104+
("--ignore-tags a,b --ignore-tags c", "'ignore_tags': 'a,b,c'"),
105+
(
106+
"--splitting-tags a,b --splitting-tags c",
107+
"'splitting_tags': 'a,b,c'",
108+
),
109+
(
110+
"--non-splitting-tags a,b --non-splitting-tags c",
111+
"'non_splitting_tags': 'a,b,c'",
112+
),
113+
]
114+
for args, search_str in extra_options:
115+
result = runner.invoke(
116+
main_function, f'-vv text --to DE "proton beam" {args}'
117+
)
118+
assert (
119+
result.exit_code == 0
120+
), f"exit: {result.exit_code}\n {result.output}"
121+
request_details = next(
122+
line
123+
for line in result.output.splitlines()
124+
if line.startswith("Request details data")
125+
)
126+
assert search_str in request_details
127+
97128

98129
def test_text_stdin(runner):
99130
result = runner.invoke(

0 commit comments

Comments
 (0)