"""Integration tests for the BM08 EXAFS processor."""

from .. import testing
from ..processors.exafs_bm08 import DemoBm08ExafsProcessor
from .utils import exafs


def bm08_exafs_demo(nrepeats: int = None, fast: bool = True):
    test_exafs_scan(nrepeats=nrepeats, fast=fast)


@testing.integration_fixture
def bm08_exafs_processor():
    return DemoBm08ExafsProcessor()


@testing.integration_test
def test_exafs_scan(bm08_exafs_processor, nrepeats: int = None, fast: bool = True):
    if nrepeats is None:
        nrepeats = bm08_exafs_processor.max_scans + 1
    bm08_exafs_processor.clear()

    scan_info = {
        "scan_parameters": {"scan_type": "Kscan"},
        "scan_metadata_categories": ["scan_parameters"],
    }

    for _ in range(nrepeats):
        exafs.test_exafs_scan(
            bm08_exafs_processor, fast=fast, scan_info=scan_info, split=False
        )
