Skip to content

Commit a4d6ac1

Browse files
talgalilimeta-codesync[bot]
authored andcommitted
Add tests to reach 100% code coverage (#412)
Summary: Pull Request resolved: #412 Add ~70 new test methods across 10 test files covering all previously uncovered lines (110 lines) in the balance package. Coverage was at 98% with gaps in balance_frame.py, sample_frame.py, sample_class.py, balancedf_class.py, cli.py, summary_utils.py, model_matrix.py, rake.py, weighted_comparisons_plots.py, and weighted_comparisons_stats.py. Key areas covered: - FutureWarning deprecation paths for id_column/weight_column property changes - Error validation branches in set_fitted_model, design_matrix, predict_proba, predict_weights - IPW model helper methods (_require_ipw_model, _matrix_to_dataframe, _align_to_index, _ipw_class_index) - Training weights fallback logic in _resolve_design_weights - SampleFrame.from_frame edge cases (string column args, missing covariates, covar/id overlap warning) - SampleFrame.rename_weight_column and from_sample validation - BalanceDF base class methods and BalanceDFOutcomes/Weights error paths - build_design_matrix scaler, penalty rescaling, and matrix type conversion branches - Rake validation for proportions (zero, NaN, inf, negative, non-float) - ASMD unknown std_type and r_indicator scalar reshaping - Empty variables early return in seaborn_plot_dist - Fix StandardScaler copy=False read-only array bug in model_matrix.py Differential Revision: D100949347 fbshipit-source-id: a02fe16b8c3d4acbb288f5e35881cedc5882b615
1 parent d775c36 commit a4d6ac1

11 files changed

Lines changed: 1446 additions & 2 deletions

balance/utils/model_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ def build_design_matrix(
823823
if fit_scaler is not None:
824824
combined_matrix = fit_scaler.transform(combined_matrix)
825825
elif scaler_weights is not None:
826-
scaler = StandardScaler(with_mean=False, copy=False)
826+
scaler = StandardScaler(with_mean=False)
827827
combined_matrix = scaler.fit_transform(
828828
combined_matrix, sample_weight=scaler_weights
829829
)

0 commit comments

Comments
 (0)