# Path: metatlas/plots/compound_eic.py
# class CompoundEic(plot_set.Plot):
#     def __init__(self, title: str, group_name: str, compound: Dict[str, Any], rt_buffer: float = 0.5):
#     def plot(self, ax: matplotlib.axes.Axes, back_color: utils.Color = "white") -> None:
#     def _draw_rt_ref_lines(self, ax: matplotlib.axes.Axes) -> None:
#     def _draw_curve(self, ax: matplotlib.axes.Axes, rt_buffer: float) -> None:
# def add_interp_at(
#     x: List[float], y: List[float], x_inserts: Sequence[float]
# ) -> Tuple[List[float], List[float]]:
# def insert_in_sorted_array(a1: np.ndarray, a2: np.ndarray) -> np.ndarray:
# def save_compound_eic_pdf(
#     data: MetatlasDataset,
#     compound_idx: int,
#     file_name: str,
#     overwrite: bool = False,
#     sharey: bool = True,
#     max_plots_per_page: int = 30,
# ) -> None:


import os
import numpy as np
from metatlas.plots import compound_eic
"""Test of EIC plotting functions"""
# pylint: disable=missing-function-docstring





def test_save_compound_eic_pdf(metatlas_dataset):
    file_name = "foo.pdf"
    compound_eic.save_compound_eic_pdf(metatlas_dataset, 0, file_name, sharey=True, overwrite=True)
    assert os.path.isfile(file_name)


def test_insert_in_sorted_array():
    arr = [1.0, 2.0, 3.0]
    assert np.array_equal(compound_eic.insert_in_sorted_array(arr, [0, 99]), [0, 1, 2, 3, 99])

# Path: metatlas/plots/compound_eic.py
# class CompoundEic(plot_set.Plot):
#     def __init__(self, title: str, group_name: str, compound: Dict[str, Any], rt_buffer: float = 0.5):
#     def plot(self, ax: matplotlib.axes.Axes, back_color: utils.Color = "white") -> None:
#     def _draw_rt_ref_lines(self, ax: matplotlib.axes.Axes) -> None:
#     def _draw_curve(self, ax: matplotlib.axes.Axes, rt_buffer: float) -> None:
# def add_interp_at(
#     x: List[float], y: List[float], x_inserts: Sequence[float]
# ) -> Tuple[List[float], List[float]]:
# def insert_in_sorted_array(a1: np.ndarray, a2: np.ndarray) -> np.ndarray:
# def save_compound_eic_pdf(
#     data: MetatlasDataset,
#     compound_idx: int,
#     file_name: str,
#     overwrite: bool = False,
#     sharey: bool = True,
#     max_plots_per_page: int = 30,
# ) -> None:


# Path: tests/unit/test_compound_eic.py
import os
import numpy as np
from metatlas.plots import compound_eic

"""Test of EIC plotting functions"""
# pylint: disable=missing-function-docstring





def test_save_compound_eic_pdf(metatlas_dataset):
    file_name = "foo.pdf"
    compound_eic.save_compound_eic_pdf(metatlas_dataset, 0, file_name, sharey=True, overwrite=True)
    assert os.path.isfile(file_name)


def test_insert_in_sorted_array():
    arr = [1.0, 2.0, 3.0]
    assert np.array_equal(compound_eic.insert_in_sorted_array(arr, [0, 99]), [0, 1, 2, 3, 99])

    assert np.array_equal(compound_eic.insert_in_sorted_array(arr, [1.5]), [1, 1.5, 2, 3])