============================= test session starts ==============================
platform darwin -- Python 3.14.8, pytest-9.1.1, pluggy-1.7.0
rootdir: <workspace>/empyrical-reloaded
configfile: pyproject.toml
plugins: platformdirs-4.13.5
collected 13 items

tests/test_zero_dispersion_ratios.py .FF.FF..F.FFF                       [100%]

=================================== FAILURES ===================================
_______ test_constant_active_return_has_infinite_excess_sharpe[0.001-21] _______

n = 21, active = 0.001

    @pytest.mark.parametrize("n", [3, 21, 252])
    @pytest.mark.parametrize("active", [0.001, -0.0001, 0.0003])
    def test_constant_active_return_has_infinite_excess_sharpe(n, active):
        # A nonzero constant active return has zero tracking error at any length.
        returns = pd.Series([active] * n)
        benchmark = pd.Series([0.0] * n)
        result = empyrical.excess_sharpe(returns, benchmark)
>       assert np.isinf(result) and np.sign(result) == np.sign(active)
E       AssertionError: assert (np.False_)
E        +  where np.False_ = <ufunc 'isinf'>(2250272360899510.0)
E        +    where <ufunc 'isinf'> = np.isinf

tests/test_zero_dispersion_ratios.py:15: AssertionError
______ test_constant_active_return_has_infinite_excess_sharpe[0.001-252] _______

n = 252, active = 0.001

    @pytest.mark.parametrize("n", [3, 21, 252])
    @pytest.mark.parametrize("active", [0.001, -0.0001, 0.0003])
    def test_constant_active_return_has_infinite_excess_sharpe(n, active):
        # A nonzero constant active return has zero tracking error at any length.
        returns = pd.Series([active] * n)
        benchmark = pd.Series([0.0] * n)
        result = empyrical.excess_sharpe(returns, benchmark)
>       assert np.isinf(result) and np.sign(result) == np.sign(active)
E       AssertionError: assert (np.False_)
E        +  where np.False_ = <ufunc 'isinf'>(1534175584049943.8)
E        +    where <ufunc 'isinf'> = np.isinf

tests/test_zero_dispersion_ratios.py:15: AssertionError
______ test_constant_active_return_has_infinite_excess_sharpe[-0.0001-21] ______

n = 21, active = -0.0001

    @pytest.mark.parametrize("n", [3, 21, 252])
    @pytest.mark.parametrize("active", [0.001, -0.0001, 0.0003])
    def test_constant_active_return_has_infinite_excess_sharpe(n, active):
        # A nonzero constant active return has zero tracking error at any length.
        returns = pd.Series([active] * n)
        benchmark = pd.Series([0.0] * n)
        result = empyrical.excess_sharpe(returns, benchmark)
>       assert np.isinf(result) and np.sign(result) == np.sign(active)
E       AssertionError: assert (np.False_)
E        +  where np.False_ = <ufunc 'isinf'>(-7200871554878430.0)
E        +    where <ufunc 'isinf'> = np.isinf

tests/test_zero_dispersion_ratios.py:15: AssertionError
_____ test_constant_active_return_has_infinite_excess_sharpe[-0.0001-252] ______

n = 252, active = -0.0001

    @pytest.mark.parametrize("n", [3, 21, 252])
    @pytest.mark.parametrize("active", [0.001, -0.0001, 0.0003])
    def test_constant_active_return_has_infinite_excess_sharpe(n, active):
        # A nonzero constant active return has zero tracking error at any length.
        returns = pd.Series([active] * n)
        benchmark = pd.Series([0.0] * n)
        result = empyrical.excess_sharpe(returns, benchmark)
>       assert np.isinf(result) and np.sign(result) == np.sign(active)
E       AssertionError: assert (np.False_)
E        +  where np.False_ = <ufunc 'isinf'>(-253932510463437.84)
E        +    where <ufunc 'isinf'> = np.isinf

tests/test_zero_dispersion_ratios.py:15: AssertionError
______ test_constant_active_return_has_infinite_excess_sharpe[0.0003-252] ______

n = 252, active = 0.0003

    @pytest.mark.parametrize("n", [3, 21, 252])
    @pytest.mark.parametrize("active", [0.001, -0.0001, 0.0003])
    def test_constant_active_return_has_infinite_excess_sharpe(n, active):
        # A nonzero constant active return has zero tracking error at any length.
        returns = pd.Series([active] * n)
        benchmark = pd.Series([0.0] * n)
        result = empyrical.excess_sharpe(returns, benchmark)
>       assert np.isinf(result) and np.sign(result) == np.sign(active)
E       AssertionError: assert (np.False_)
E        +  where np.False_ = <ufunc 'isinf'>(1841010700859932.2)
E        +    where <ufunc 'isinf'> = np.isinf

tests/test_zero_dispersion_ratios.py:15: AssertionError
__________ test_constant_return_sharpe_is_infinite_for_any_length[21] __________

n = 21

    @pytest.mark.parametrize("n", [3, 21, 252])
    def test_constant_return_sharpe_is_infinite_for_any_length(n):
>       assert np.isposinf(empyrical.sharpe_ratio(pd.Series([0.001] * n)))
E       AssertionError: assert np.False_
E        +  where np.False_ = <function isposinf at 0x106ad8070>(3.5721966294613744e+16)
E        +    where <function isposinf at 0x106ad8070> = np.isposinf
E        +    and   3.5721966294613744e+16 = <function sharpe_ratio at 0x11988fcc0>(0     0.001\n1     0.001\n2     0.001\n3     0.001\n4     0.001\n5     0.001\n6     0.001\n7     0.001\n8     0.001\n9     0.00...   0.001\n13    0.001\n14    0.001\n15    0.001\n16    0.001\n17    0.001\n18    0.001\n19    0.001\n20    0.001\ndtype: float64)
E        +      where <function sharpe_ratio at 0x11988fcc0> = empyrical.sharpe_ratio
E        +      and   0     0.001\n1     0.001\n2     0.001\n3     0.001\n4     0.001\n5     0.001\n6     0.001\n7     0.001\n8     0.001\n9     0.00...   0.001\n13    0.001\n14    0.001\n15    0.001\n16    0.001\n17    0.001\n18    0.001\n19    0.001\n20    0.001\ndtype: float64 = <class 'pandas.Series'>(([0.001] * 21))
E        +        where <class 'pandas.Series'> = pd.Series

tests/test_zero_dispersion_ratios.py:20: AssertionError
_________ test_constant_return_sharpe_is_infinite_for_any_length[252] __________

n = 252

    @pytest.mark.parametrize("n", [3, 21, 252])
    def test_constant_return_sharpe_is_infinite_for_any_length(n):
>       assert np.isposinf(empyrical.sharpe_ratio(pd.Series([0.001] * n)))
E       AssertionError: assert np.False_
E        +  where np.False_ = <function isposinf at 0x106ad8070>(2.4354282377420536e+16)
E        +    where <function isposinf at 0x106ad8070> = np.isposinf
E        +    and   2.4354282377420536e+16 = <function sharpe_ratio at 0x11988fcc0>(0      0.001\n1      0.001\n2      0.001\n3      0.001\n4      0.001\n       ...  \n247    0.001\n248    0.001\n249    0.001\n250    0.001\n251    0.001\nLength: 252, dtype: float64)
E        +      where <function sharpe_ratio at 0x11988fcc0> = empyrical.sharpe_ratio
E        +      and   0      0.001\n1      0.001\n2      0.001\n3      0.001\n4      0.001\n       ...  \n247    0.001\n248    0.001\n249    0.001\n250    0.001\n251    0.001\nLength: 252, dtype: float64 = <class 'pandas.Series'>(([0.001] * 252))
E        +        where <class 'pandas.Series'> = pd.Series

tests/test_zero_dispersion_ratios.py:20: AssertionError
_____________ test_constant_columns_do_not_affect_varying_columns ______________

    def test_constant_columns_do_not_affect_varying_columns():
        returns = pd.DataFrame(
            {"flat": [0.001] * 252, "noisy": np.linspace(-0.01, 0.012, 252)}
        )
        result = empyrical.sharpe_ratio(returns)
>       assert np.isposinf(result[0])
E       assert np.False_
E        +  where np.False_ = <function isposinf at 0x106ad8070>(np.float64(2.4354282377420536e+16))
E        +    where <function isposinf at 0x106ad8070> = np.isposinf

tests/test_zero_dispersion_ratios.py:28: AssertionError
=========================== short test summary info ============================
FAILED tests/test_zero_dispersion_ratios.py::test_constant_active_return_has_infinite_excess_sharpe[0.001-21]
FAILED tests/test_zero_dispersion_ratios.py::test_constant_active_return_has_infinite_excess_sharpe[0.001-252]
FAILED tests/test_zero_dispersion_ratios.py::test_constant_active_return_has_infinite_excess_sharpe[-0.0001-21]
FAILED tests/test_zero_dispersion_ratios.py::test_constant_active_return_has_infinite_excess_sharpe[-0.0001-252]
FAILED tests/test_zero_dispersion_ratios.py::test_constant_active_return_has_infinite_excess_sharpe[0.0003-252]
FAILED tests/test_zero_dispersion_ratios.py::test_constant_return_sharpe_is_infinite_for_any_length[21]
FAILED tests/test_zero_dispersion_ratios.py::test_constant_return_sharpe_is_infinite_for_any_length[252]
FAILED tests/test_zero_dispersion_ratios.py::test_constant_columns_do_not_affect_varying_columns
========================= 8 failed, 5 passed in 0.85s ==========================
