Skip to content

test: MovesManagementClassifier.fit never exercises the DataFrame feature_names_in_ branch #54

Description

@shivamlalakiya

What's wrong

MovesManagementClassifier.fit branches on whether X has a .columns
attribute, setting feature_names_in_ from the column names when it does.
Every test in tests/test_moves.py fits with a bare ndarray, so the
pd.DataFrame branch never runs and feature_names_in_ is never exercised via
a real DataFrame input.

Where

File Locate with
philanthropy/models/_moves.py grep -n 'hasattr(X, "columns")' philanthropy/models/_moves.py

What to change

No source change — this is test-only.

  1. Open tests/test_moves.py and find the existing fit-related fixture/test
    (locate with grep -n "def test_" tests/test_moves.py | head) for the style
    used to build X/y.
  2. Add a test that fits MovesManagementClassifier on a pandas.DataFrame with
    named columns and asserts feature_names_in_ equals those column names
    (np.array([...], dtype=object)).

Tests to add or extend

  • File: tests/test_moves.py
  • Add: test_fit_with_dataframe_sets_feature_names_in

Done when

python -m pytest tests/test_moves.py --cov=philanthropy.models._moves --cov-report=term-missing -q

philanthropy/models/_moves.py reads 100% covered with an empty Missing column.

Metadata

Metadata

Assignees

No one assigned

    Labels

    beginnerNo fundraising domain knowledge neededeasySmall, well-scoped, single-file changegood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions