Skip to content

Commit f61378b

Browse files
Update unit tests for server error message changes
1 parent ca5d5a1 commit f61378b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tests/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,14 @@ def test_document_occupied_output(runner, tmpdir):
167167
def test_invalid_document(runner, tmpdir):
168168
tmpdir = pathlib.Path(tmpdir)
169169
output_dir = tmpdir / "output"
170-
input_document = tmpdir / "document.xyz"
170+
input_document = tmpdir / "document.invalid"
171171
input_document.write_text(example_text["EN"])
172172

173173
result = runner.invoke(
174174
deepl.__main__, f"-vv document --to DE {input_document} {output_dir}"
175175
)
176176
assert result.exit_code == 1, f"exit: {result.exit_code}\n {result.output}"
177-
assert "Invalid file" in result.output
177+
assert "Invalid file" in result.output or "file extension" in result.output
178178

179179

180180
def test_glossary_no_subcommand(runner):

tests/test_translate_document.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,13 @@ def test_invalid_document(translator, tmpdir):
162162
tmpdir = pathlib.Path(tmpdir)
163163
output_dir = tmpdir / "output"
164164
output_dir.mkdir()
165-
input_document = tmpdir / "document.xyz"
165+
input_document = tmpdir / "document.invalid"
166166
input_document.write_text(example_text["EN"])
167-
output_document = output_dir / "document.xyz"
167+
output_document = output_dir / "document.invalid"
168168

169-
with pytest.raises(deepl.DeepLException, match="Invalid file"):
169+
with pytest.raises(
170+
deepl.DeepLException, match="(Invalid file)|(file extension)"
171+
):
170172
translator.translate_document_from_filepath(
171173
input_document, output_path=output_document, **default_lang_args
172174
)

0 commit comments

Comments
 (0)