Skip to content

Conversation

@wagner-austin
Copy link
Contributor

Description

The test_numeric_split_direction test was skipping the [use_missing=True, zero_as_missing=True] parameter combination instead of properly testing it.

When both flags are True:

  • use_missing=True: NaN values are treated as missing
  • zero_as_missing=True: Zero values are also treated as missing
  • Both zeros and NaN reach the same leaf (both are "missing")

The original assertion assert expected_leaf_zero != expected_leaf_nan would fail for this case, which is why it was skipped. The fix properly tests this case by checking for the same leaf when zero_as_missing=True.

Test Plan

BEFORE (master):

  • test_numeric_split_direction[True-True]: SKIPPED
  • test_numeric_split_direction[True-False]: PASSED
  • test_numeric_split_direction[False-True]: PASSED
  • test_numeric_split_direction[False-False]: PASSED
  • Total: 3 passed, 1 skipped

AFTER (this PR):

  • All 4 parameter combinations: PASSED
  • Total: 4 passed, 0 skipped

…er combinations

The test was skipping the [use_missing=True, zero_as_missing=True] combination
instead of properly testing it. When both flags are True, zeros and NaN are both
treated as missing and reach the same leaf. The assertion now correctly checks
for same leaf (when zero_as_missing=True) vs different leaves (when False).
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

Oh interesting, thanks so much for looking into this!!

The proposed changes and code comments look clear and correct to me. this is a nice improvement to the testing coverage.

I see that pytest.skip() was added in #5119 but I don't recall why and don't see conversation related to it. @jmoralez could you double-check this PR if you have time?

@StrikerRUS
Copy link
Collaborator

conversation related to it.

Here it is: #5119 (comment)

@jameslamb
Copy link
Collaborator

Thanks @StrikerRUS I did see that, but do you recall why the pytest.skip was added? It seems to me that that skip means the tests do not cover all possible combinations of cases like you'd asked for.

I just meant I do not see any conversation about the use_missing=True, zero_as_missing=True case being skipped.

@StrikerRUS
Copy link
Collaborator

@jameslamb I'm afraid there was no such conversation, unfortunately. You're right.

@jameslamb
Copy link
Collaborator

Ok thank you. I don't see any reason that should be skipped, so I think we can safely merge this.

@jmoralez whenever you see this (even if it's after it's merged) please do let us know if you remember why that combination was skipped.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants