Skip to content

Merton test fixture references undefined returns variable #4

Open

Description

@KSHITIZ6341

Summary

tests/test_merton_process.py::simple_returns_data creates normal_returns and jump_returns, but then calls np.random.shuffle(returns) and returns pd.Series(returns) without ever defining returns.

Once the missing statsmodels dependency is installed locally, the focused test errors during fixture setup.

Reproduction

Tested on commit b0c13aa after installing statsmodels locally to get past import collection:

MPLBACKEND=Agg .venv/bin/python -m pytest -q \
  tests/test_merton_process.py::test_merton_process_fit_with_explicit_dt

Actual result

NameError: name 'returns' is not defined

The fixture currently has:

normal_returns = np.random.normal(0, 0.01, int(n * 0.9))
jump_returns = np.random.normal(-0.03, 0.02, int(n * 0.1))
np.random.shuffle(returns)
return pd.Series(returns)

Expected result

The fixture should combine normal_returns and jump_returns before shuffling/returning them, for example by assigning returns = np.concatenate([normal_returns, jump_returns]).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions