mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-04-17 07:55:15 +00:00
* All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes.
32 lines
913 B
Python
32 lines
913 B
Python
from pathlib import Path
|
|
|
|
from matplotlib.testing.compare import compare_images
|
|
|
|
from akkudoktoreos.utils.visualize import generate_example_report
|
|
|
|
filename = "example_report.pdf"
|
|
|
|
|
|
DIR_TESTDATA = Path(__file__).parent / "testdata"
|
|
reference_file = DIR_TESTDATA / "test_example_report.pdf"
|
|
|
|
|
|
def test_generate_pdf_example(config_eos):
|
|
"""Test generation of example visualization report."""
|
|
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()
|
|
|
|
# Check if the file exists
|
|
assert output_file.exists()
|
|
|
|
# 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}"
|