Files
EOS/tests/test_visualize.py
T

32 lines
913 B
Python
Raw Normal View History

2024-11-10 23:22:30 +01:00
from pathlib import Path
from matplotlib.testing.compare import compare_images
2024-12-29 18:42:49 +01:00
from akkudoktoreos.utils.visualize import generate_example_report
2024-12-24 13:10:31 +01:00
filename = "example_report.pdf"
2024-11-10 23:22:30 +01:00
DIR_TESTDATA = Path(__file__).parent / "testdata"
2024-12-24 13:10:31 +01:00
reference_file = DIR_TESTDATA / "test_example_report.pdf"
2024-11-10 23:22:30 +01:00
def test_generate_pdf_example(config_eos):
2024-12-29 18:42:49 +01:00
"""Test generation of example visualization report."""
2025-01-12 05:19:37 +01:00
output_dir = config_eos.general.data_output_path
assert output_dir is not None
output_file = output_dir / filename
assert not output_file.exists()
# Generate PDF
generate_example_report()
2024-11-11 21:38:13 +01:00
2024-12-24 13:10:31 +01:00
# Check if the file exists
assert output_file.exists()
2024-12-24 13:10:31 +01:00
# Compare the generated file with the reference file
comparison = compare_images(str(reference_file), str(output_file), tol=0)
# Assert that there are no differences
assert comparison is None, f"Images differ: {comparison}"