Skip to content

Added missing space to exception message #4308

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

Merged
merged 1 commit into from
Mar 1, 2015

Conversation

terrycojones
Copy link
Contributor

There was a ValueError being raised on line 82 of sklearn/metrics/cluster/unsupervised.py that had a missing space.

I went to fix it and realized the error message was actually incorrect (the test was that 2 <= n_labels but the error message said the number of labels had to be more than 2).

So I improved the error message (IMO, at least) and I simplified the test, from if not 2 <= n_labels <= n_samples-1 to if not 1 < n_labels < n_samples which feels cleaner to me.

I also updated the two tests of the error message. Note that the error text is a regex so regex metacharacters (. and ( and )) are backslash quoted.

@jnothman
Copy link
Member

jnothman commented Mar 1, 2015

Thanks... I have fixed this in https://github.com/scikit-learn/scikit-learn/pull/4087/files#diff-1190a10b67dd12abc6c869b9ba329f8aR90 but I guess I haven't pushed that PR towards merge of late.

@jnothman
Copy link
Member

jnothman commented Mar 1, 2015

LGTM. Thanks.

jnothman added a commit that referenced this pull request Mar 1, 2015
Added missing space to exception message
@jnothman jnothman merged commit 1c7f6f4 into scikit-learn:master Mar 1, 2015
@terrycojones
Copy link
Contributor Author

Thanks Joe! Sorry about the overlap with #4087 It would have been fine to just close this pr, BTW.

@jnothman
Copy link
Member

jnothman commented Mar 1, 2015

You're not to have foreseen the overlap! #4087 may not be merged for a while yet, and needs a rebase in any case, so no harm done by fixing the error now!

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