Skip to content

Commit 9fcb11a

Browse files
committed
test_x2pdf.py returned to the previous state
1 parent bf50183 commit 9fcb11a

File tree

1 file changed

+16
-35
lines changed

1 file changed

+16
-35
lines changed

tests/test_x2pdf.py

+16-35
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,23 @@
99
from .conftest import run_cli
1010

1111

12-
def test_x2pdf_with_format(capsys, tmp_path: Path) -> None:
12+
def test_x2pdf(capsys, tmp_path: Path) -> None:
1313
# Arrange
1414
output = tmp_path / "out.pdf"
1515
assert not output.exists()
16-
17-
formats_to_test = [
18-
"Letter",
19-
"A4-portrait",
20-
"A4-landscape",
21-
"210x297",
22-
"invalid-format"
23-
]
24-
25-
for format_option in formats_to_test:
26-
# Act
27-
exit_code = run_cli(
28-
[
29-
"x2pdf",
30-
"sample-files/003-pdflatex-image/page-0-Im1.jpg",
31-
"--output",
32-
str(output),
33-
"--format",
34-
format_option,
35-
]
36-
)
3716

38-
# Assert
39-
captured = capsys.readouterr()
40-
41-
# For valid formats, we expect a successful exit code and the output file to exist
42-
if format_option != "invalid-format":
43-
assert exit_code == 0, captured
44-
assert captured.out == ""
45-
assert output.exists()
46-
else:
47-
# For an invalid format, we expect a non-zero exit code (indicating failure)
48-
assert exit_code != 0
49-
assert "Invalid format" in captured.err # Check for expected error message
50-
output.unlink(missing_ok=True) # Clean up for the next test iteration
17+
# Act
18+
exit_code = run_cli(
19+
[
20+
"x2pdf",
21+
"sample-files/003-pdflatex-image/page-0-Im1.jpg",
22+
"--output",
23+
str(output),
24+
]
25+
)
26+
27+
# Assert
28+
captured = capsys.readouterr()
29+
assert exit_code == 0, captured
30+
assert captured.out == ""
31+
assert output.exists()

0 commit comments

Comments
 (0)