import pandas as pd

from featureleak import LeakScanner


def test_detects_high_target_correlation():
    df = pd.DataFrame(
        {
            "sales": [10, 20, 30, 40, 50],
            "future_sales": [10, 20, 30, 40, 50],
            "noise": [3, 1, 5, 2, 4],
        }
    )

    scanner = LeakScanner(target_corr_threshold=0.95)
    report = scanner.analyse(df, target="sales", show_summary=False)

    assert "future_sales" in report.high_risk_features
    assert any(issue.check == "target_leakage" for issue in report.issues)


def test_detects_suspicious_column_name():
    df = pd.DataFrame(
        {
            "sales": [10, 20, 30],
            "next_sales_value": [20, 30, 40],
            "price": [1, 2, 3],
        }
    )

    scanner = LeakScanner()
    report = scanner.analyse(df, target="sales", show_summary=False)

    assert any(issue.check == "target_leakage" for issue in report.issues)