# Generated by CodiumAI
import pytest

from causalexplain.explainability.regression_quality import RegQuality

# Tests that the method returns the correct indices of features that are both gamma
# and outliers for a list of scores with length > 1


def test_happy_path():
    # Arrange
    scores = [0.9186, 0.0916, 0.0594, 0.0119, 0.0206,
              0.0137, 0.0031, 0.002, 0.0016, 0.0009]
    expected_indices = {0}

    # Act
    result = RegQuality.predict(scores)

    # Assert
    assert result == expected_indices

# Tests that the method raises an exception when given an empty list of scores


def test_edge_case_empty_list():
    # Arrange
    scores = []
    # Assert
    result = RegQuality.predict(scores)
    assert result == set()

# Tests that the method returns an empty set when given a list of scores with length 1


def test_edge_case_single_score():
    # Arrange
    scores = [1.0]
    expected_indices = set()

    # Act
    result = RegQuality.predict(scores)

    # Assert
    assert result == expected_indices

# Tests that the method returns the correct indices of features that are both gamma
# and outliers when all scores are outliers


def test_other_case_all_outliers():
    # Arrange
    scores = [10.0, 20.0, 30.0, 40.0, 50.0]
    expected_indices = set()

    # Act
    result = RegQuality.predict(scores)

    # Assert
    assert result == expected_indices

# Tests that the method returns the correct indices of features that are both
# gamma and outliers when all scores are gamma


def test_other_case_all_gamma():
    # Arrange
    scores = [0.01, 0.002, 0.03, 0.4]
    expected_indices = {3}

    # Act
    result = RegQuality.predict(scores, verbose=True)

    # Assert
    assert result == expected_indices
