Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG] Fixing wrapping in named_test.test_common #8558

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

Closed
wants to merge 4 commits into from

Conversation

kahnchana
Copy link

Reference Issue #8507

What does this implement/fix? Explain your changes.

The issue is common to five functions. Not only test_sample_weight_invariance. However, this pull request only fixes test_sample_weight_invariance.

The functions:

test_averaging_multiclass
test_averaging_multilabel
test_averaging_multilabel_all_zeroes
test_averaging_multilabel_all_ones
test_sample_weight_invariance

are generative functions made to yield a particular output. However, the test simply calls the generator function without iterating through them. This change fixes that, by defining an additional function to iterate through each metric.

Any other comments?

These functions were added in commit #7620.

@lesteve
Copy link
Member

lesteve commented Mar 9, 2017

The Travis error is a flake8 error that you need to fix. Please invest some time to configure on-the-fly flake8 checks inside your editor of choice. This allows you to spot these kind of problems while editing.

# matrix instead of a number. Testing of
# confusion_matrix with sample_weight is in
# test_classification.py
"confusion_matrix", # Left this one here because the tests in this file do
Copy link
Member

Choose a reason for hiding this comment

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

This is fine for now but from next time kindly avoid unrelated changes :)

invalids =[([0, 1], [np.inf, np.inf]),
([0, 1], [np.nan, np.nan]),
([0, 1], [np.nan, np.inf])]
invalids = [([0, 1], [np.inf, np.inf]),
Copy link
Member

Choose a reason for hiding this comment

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

same comment as above

def test_sample_weight_invariance(n_samples=50):
# iterate through each metric testing each case
for metrics in generate_sample_weight_invariance(n_samples):
pass
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the original issue as I commented there and I don't think you need this since nose supports yield in test functions ...

@gxyd
Copy link
Contributor

gxyd commented Oct 23, 2017

Does this PR fixes the corresponding issue? Otherwise I might want to try to fix this.

@lesteve
Copy link
Member

lesteve commented Oct 23, 2017

I am going to close this PR due to lack of activity.

@lesteve lesteve closed this Oct 23, 2017
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.

4 participants