"""Tests para plot_kde_2d."""

import sys
from pathlib import Path

import matplotlib
matplotlib.use("Agg")

sys.path.insert(0, str(Path(__file__).parent.parent.parent))

from datascience.plot_kde_2d import plot_kde_2d


def test_50_puntos_aleatorios_no_lanza_excepcion():
    import matplotlib.pyplot as plt
    import numpy as np

    rng = np.random.default_rng(42)
    xs = rng.normal(0, 1, 50)
    ys = rng.normal(0, 1, 50)

    fig, ax = plt.subplots()
    plot_kde_2d(ax, xs, ys)
    plt.close(fig)


def test_arrays_vacios_retorna_sin_error():
    import matplotlib.pyplot as plt

    fig, ax = plt.subplots()
    plot_kde_2d(ax, [], [])
    plt.close(fig)
