Skip to content

MAINT:Fix assert raises in sklearn/feature_selection/tests/#14697

Merged
qinhanmin2014 merged 10 commits intoscikit-learn:masterfrom
sameshl:mnt_tests_feature_selection
Aug 21, 2019
Merged

MAINT:Fix assert raises in sklearn/feature_selection/tests/#14697
qinhanmin2014 merged 10 commits intoscikit-learn:masterfrom
sameshl:mnt_tests_feature_selection

Conversation

@sameshl
Copy link
Copy Markdown
Contributor

@sameshl sameshl commented Aug 20, 2019

replaced assert_raises and assert_raises_regex with pytest.raises context manager.

related to #14216


for X in [data, csr_matrix(data), csc_matrix(data), bsr_matrix(data)]:
sel = VarianceThreshold().fit(X)
assert_array_equal([0, 1, 3, 4], sel.get_support(indices=True))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think it's good to use pytest.mark.parametrize here, because we'll run same test for multiple times.


assert_raises(ValueError, VarianceThreshold().fit, [[0, 1, 2, 3]])
assert_raises(ValueError, VarianceThreshold().fit, [[0, 1], [0, 1]])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do not remove this line, we need two lines between functions

@qinhanmin2014 qinhanmin2014 merged commit a2968c2 into scikit-learn:master Aug 21, 2019
@sameshl sameshl deleted the mnt_tests_feature_selection branch August 21, 2019 12:59
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.

2 participants