Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating testing approach for MedianImputer Transformer #220

Merged
merged 4 commits into from
Apr 11, 2024

Conversation

Ritunjai-Sharma
Copy link
Contributor

Connected to #150

Moved testing for MedianImputer Transformer to new approach

@Ritunjai-Sharma Ritunjai-Sharma linked an issue Apr 8, 2024 that may be closed by this pull request
@Ritunjai-Sharma
Copy link
Contributor Author

Ritunjai-Sharma commented Apr 8, 2024

I have left a few tests unchanged/haven't removed them. These are:

  1. TestFit:
  • test_learnt_values and test_learnt_values_weighted: Couldn't find an equivalent test for this in tests.base_tests.GenericFitTests

  • test_fit_returns_self_weighted: Although test_fit_returns_self in tests.base_tests.GenericFitTests tests for similar behaviour, it doesn't seem test for the case when weight parameter is populated.

  • test_fit_not_changing_data and test_fit_not_changing_data_weighted: Couldn't find an equivalent test for this in tests.base_tests.GenericFitTests

  1. TestTransform:
  • test_learnt_values_not_modified_weights: Although test_impute_value_unchanged in test_BaseImputer.GenericImputerTransformTests tests for similar behavior, it doesn't seem to test for the case when weight parameter is populated.

Let me know if any of these need to be removed :)


@pytest.mark.parametrize("weight", (0, ["a"], {"a": 10}))
def test_weight_arg_errors(self, weight):
def test_weight_arg_errors(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with leaving this in until issue is resolved

expected_call_args,
):
x.transform(df)

@pytest.mark.parametrize(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this one is covered by the GenerateImputerTransform tests?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with the next 2 - though maybe we can parametrize the inherited test to work with and without weights?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this :) I have now removed test_nulls_imputed_correctly_1 and test_nulls_imputed_correctly_2 as well as expected_df_1 and expected_df_2, here: 2d7b045. Regarding testing with and without weights, perhaps it's best to add this functionality as part of #221 so that all transformers with weights can have this functionality? So, for now, I have renamed test_nulls_imputed_correctly_3 to test_nulls_imputed_correctly_weights and not deleted it. Let me know if all this makes sense!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, thanks RJ :)

@limlam96 limlam96 merged commit f391831 into main Apr 11, 2024
12 checks passed
@limlam96 limlam96 deleted the feature/median_imputer_test_overhaul branch April 11, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bring MedianImputer in line with new testing setup
2 participants