# Path: seaborn/_statistics.py
# class KDE:
# class Histogram:
# class ECDF:
# class EstimateAggregator:
#     def __init__(
#         self, *,
#         bw_method=None,
#         bw_adjust=1,
#         gridsize=200,
#         cut=3,
#         clip=None,
#         cumulative=False,
#     ):
#     def _define_support_grid(self, x, bw, cut, clip, gridsize):
#     def _define_support_univariate(self, x, weights):
#     def _define_support_bivariate(self, x1, x2, weights):
#     def define_support(self, x1, x2=None, weights=None, cache=True):
#     def _fit(self, fit_data, weights=None):
#     def _eval_univariate(self, x, weights=None):
#     def _eval_bivariate(self, x1, x2, weights=None):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(
#         self,
#         stat="count",
#         bins="auto",
#         binwidth=None,
#         binrange=None,
#         discrete=False,
#         cumulative=False,
#     ):
#     def _define_bin_edges(self, x, weights, bins, binwidth, binrange, discrete):
#     def define_bin_params(self, x1, x2=None, weights=None, cache=True):
#     def _eval_bivariate(self, x1, x2, weights):
#     def _eval_univariate(self, x, weights):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(self, stat="proportion", complementary=False):
#     def _eval_bivariate(self, x1, x2, weights):
#     def _eval_univariate(self, x, weights):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(self, estimator, errorbar=None, **boot_kws):
#     def __call__(self, data, var):
# def _percentile_interval(data, width):
# def _validate_errorbar_arg(arg):
#     DEFAULT_LEVELS = {
#         "ci": 95,
#         "pi": 95,
#         "se": 1,
#         "sd": 1,
#     }


import numpy as np
import pandas as pd
    import statsmodels.distributions as smdist
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
from .._statistics import (
    KDE,
    Histogram,
    ECDF,
    EstimateAggregator,
    _validate_errorbar_arg,
    _no_scipy,
)
        assert_array_equal(out_orig, out_test)

    def test_custom_errorbars(self, long_df):

        f = lambda x: (x.min(), x.max())  # noqa: E731
        agg = EstimateAggregator("mean", f)
        out = agg(long_df, "y")
        assert out["ymin"] == long_df["y"].min()
        assert out["ymax"] == long_df["y"].max()

    def test_singleton_errorbars(self):

        agg = EstimateAggregator("mean", "ci")
        val = 7
        out = agg(pd.DataFrame(dict(y=[val])), "y")
        assert out["y"] == val
        assert pd.isna(out["ymin"])
        assert pd.isna(out["ymax"])

    def test_errorbar_validation(self):

        method, level = _validate_errorbar_arg(("ci", 99))
        assert method == "ci"
        assert level == 99

        method, level = _validate_errorbar_arg("sd")
        assert method == "sd"
        assert level == 1

        f = lambda x: (x.min(), x.max())  # noqa: E731

# Path: seaborn/_statistics.py
# class KDE:
# class Histogram:
# class ECDF:
# class EstimateAggregator:
#     def __init__(
#         self, *,
#         bw_method=None,
#         bw_adjust=1,
#         gridsize=200,
#         cut=3,
#         clip=None,
#         cumulative=False,
#     ):
#     def _define_support_grid(self, x, bw, cut, clip, gridsize):
#     def _define_support_univariate(self, x, weights):
#     def _define_support_bivariate(self, x1, x2, weights):
#     def define_support(self, x1, x2=None, weights=None, cache=True):
#     def _fit(self, fit_data, weights=None):
#     def _eval_univariate(self, x, weights=None):
#     def _eval_bivariate(self, x1, x2, weights=None):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(
#         self,
#         stat="count",
#         bins="auto",
#         binwidth=None,
#         binrange=None,
#         discrete=False,
#         cumulative=False,
#     ):
#     def _define_bin_edges(self, x, weights, bins, binwidth, binrange, discrete):
#     def define_bin_params(self, x1, x2=None, weights=None, cache=True):
#     def _eval_bivariate(self, x1, x2, weights):
#     def _eval_univariate(self, x, weights):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(self, stat="proportion", complementary=False):
#     def _eval_bivariate(self, x1, x2, weights):
#     def _eval_univariate(self, x, weights):
#     def __call__(self, x1, x2=None, weights=None):
#     def __init__(self, estimator, errorbar=None, **boot_kws):
#     def __call__(self, data, var):
# def _percentile_interval(data, width):
# def _validate_errorbar_arg(arg):
#     DEFAULT_LEVELS = {
#         "ci": 95,
#         "pi": 95,
#         "se": 1,
#         "sd": 1,
#     }


# Path: seaborn/tests/test_statistics.py
import numpy as np
import pandas as pd
    import statsmodels.distributions as smdist
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
from .._statistics import (
    KDE,
    Histogram,
    ECDF,
    EstimateAggregator,
    _validate_errorbar_arg,
    _no_scipy,
)

        assert_array_equal(out_orig, out_test)

    def test_custom_errorbars(self, long_df):

        f = lambda x: (x.min(), x.max())  # noqa: E731
        agg = EstimateAggregator("mean", f)
        out = agg(long_df, "y")
        assert out["ymin"] == long_df["y"].min()
        assert out["ymax"] == long_df["y"].max()

    def test_singleton_errorbars(self):

        agg = EstimateAggregator("mean", "ci")
        val = 7
        out = agg(pd.DataFrame(dict(y=[val])), "y")
        assert out["y"] == val
        assert pd.isna(out["ymin"])
        assert pd.isna(out["ymax"])

    def test_errorbar_validation(self):

        method, level = _validate_errorbar_arg(("ci", 99))
        assert method == "ci"
        assert level == 99

        method, level = _validate_errorbar_arg("sd")
        assert method == "sd"
        assert level == 1

        f = lambda x: (x.min(), x.max())  # noqa: E731

        method, level = _validate_errorbar_arg(f)