From e8914cadcf9601bcd2ed1897a36a296776d0613a Mon Sep 17 00:00:00 2001 From: stoppo22 Date: Mon, 24 Aug 2026 18:23:12 +0200 Subject: [PATCH 1/3] test: cover DataFrame feature names in MovesManagementClassifier --- tests/test_moves.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_moves.py b/tests/test_moves.py index 6868500..4cbe566 100644 --- a/tests/test_moves.py +++ b/tests/test_moves.py @@ -5,6 +5,7 @@ """ import numpy as np +import pandas as pd import pytest from philanthropy.models import MovesManagementClassifier @@ -55,3 +56,21 @@ def test_action_priority_summary_counts_every_donor(stage_Xy): summary = clf.action_priority(X)["portfolio_summary"] assert sum(summary.values()) == 30 assert set(summary) <= set(_STAGES) + + +def test_fit_with_dataframe_sets_feature_names_in(): + X = pd.DataFrame( + np.random.default_rng(0).random((30, 5)), + columns=["age", "income", "donations", "engagement", "years_active"], + ) + y = np.asarray(_STAGES * 10) + + clf = MovesManagementClassifier(max_iter=10, random_state=0).fit(X, y) + + np.testing.assert_array_equal( + clf.feature_names_in_, + np.array( + ["age", "income", "donations", "engagement", "years_active"], + dtype=object, + ), + ) \ No newline at end of file From 4c3ad6f3b7df53bd58706436592c0fc7ab008b1a Mon Sep 17 00:00:00 2001 From: stoppo22 Date: Mon, 24 Aug 2026 18:33:19 +0200 Subject: [PATCH 2/3] docs: update changelog and contributors --- CHANGELOG.md | 2 ++ CONTRIBUTORS.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b4a735..45fe8b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) NaN with a `UserWarning` naming them, and a column where nothing parses (all-complex included) still raises `could not parse` per the documented contract. Closes #129. + - Added regression coverage ensuring `MovesManagementClassifier.fit` preserves + DataFrame column names in `feature_names_in_`. Closes #54. ### Added - **`models.GiftIntervalCalibrator`**: distribution-free intervals on a dollar amount. Wraps an already-fitted regressor (`AskAmountRecommender`, diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e0e699d..06e8a73 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -34,6 +34,8 @@ contribution. Code, docs, tests, and review all count. ([#64](https://github.com/PhilanthroPy-Project/PhilanthroPy/pull/64), [#65](https://github.com/PhilanthroPy-Project/PhilanthroPy/pull/65), [#66](https://github.com/PhilanthroPy-Project/PhilanthroPy/pull/66)). + - [@stoppo22](https://github.com/stoppo22): added DataFrame feature-name + coverage for `MovesManagementClassifier.fit`. ## Getting listed From 3f6f2fce3f34805b5f467d69542bfc9f78037ec2 Mon Sep 17 00:00:00 2001 From: Shivam Lalakiya Date: Mon, 24 Aug 2026 14:52:51 -0500 Subject: [PATCH 3/3] docs: unnest the changelog and contributor entries The changelog line landed as a sub-bullet of the CRMCleaner entry under ### Fixed; test coverage is an addition, so move it to ### Added at top level. The CONTRIBUTORS line was indented two spaces, rendering as a child of the entry above it. --- CHANGELOG.md | 4 ++-- CONTRIBUTORS.md | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58f4921..a415057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,14 +11,14 @@ Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) CONTRIBUTORS.md. Implemented as `scripts/check_credit.sh`, wired into `ci.yml` on `pull_request` events only; failures surface as inline `::error::` annotations on the Files tab. Closes #113. +- Regression coverage ensuring `MovesManagementClassifier.fit` preserves + DataFrame column names in `feature_names_in_`. Closes #54. ### Fixed - `CRMCleaner.transform` no longer silently corrupts complex amounts into wrong finite floats: cells holding actual `complex` values are masked to NaN with a `UserWarning` naming them, and a column where nothing parses (all-complex included) still raises `could not parse` per the documented contract. Closes #129. - - Added regression coverage ensuring `MovesManagementClassifier.fit` preserves - DataFrame column names in `feature_names_in_`. Closes #54. ### Added - **`models.GiftIntervalCalibrator`**: distribution-free intervals on a dollar amount. Wraps an already-fitted regressor (`AskAmountRecommender`, diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 06e8a73..cfd61b4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -34,8 +34,9 @@ contribution. Code, docs, tests, and review all count. ([#64](https://github.com/PhilanthroPy-Project/PhilanthroPy/pull/64), [#65](https://github.com/PhilanthroPy-Project/PhilanthroPy/pull/65), [#66](https://github.com/PhilanthroPy-Project/PhilanthroPy/pull/66)). - - [@stoppo22](https://github.com/stoppo22): added DataFrame feature-name - coverage for `MovesManagementClassifier.fit`. +- [@stoppo22](https://github.com/stoppo22): added DataFrame feature-name + coverage for `MovesManagementClassifier.fit` + ([#146](https://github.com/PhilanthroPy-Project/PhilanthroPy/pull/146)). ## Getting listed