8000 [MRG +1] MNT TST Use assert_raises instead of legacy constructions by rth · Pull Request #12057 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[MRG +1] MNT TST Use assert_raises instead of legacy constructions #12057

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
Sep 13, 2018

Conversation

rth
Copy link
Member
@rth rth commented Sep 12, 2018

Minor maintenance fix that replaces,

try:
   something
except ExceptedException:
   pass
else:
   raise AssertionError(error_message)

with pytest.raises which is more readable and helps increase coverage (by a few lines). Using assert_raises would have also worked.

@rth
Copy link
Member Author
rth commented Sep 12, 2018

For some reason in the Py3.7 Travis CI build (with latest dependencies) all tests are failing with,

/home/travis/build/scikit-learn/scikit-learn/sklearn/datasets/__init__.py:20: in <module>
    from .mlcomp import load_mlcomp
E     File "/home/travis/build/scikit-learn/scikit-learn/sklearn/datasets/mlcomp.py", line 63
E       """
E        ^
E   SyntaxError: invalid escape sequence \_
_____ ERROR collecting sklearn/cluster/tests/test_affinity_propagation.py ______

This PR doesn't modify that file, I think it might be due some changes in the latest pytest. That escape sequence was added to the docstring in #11241. Will wait to see if other PRs are also getting this error.

Edit: fixed in #12058

@jorisvandenbossche jorisvandenbossche changed the title [MRG] MNT TST Use assert_raises instead of legacy constructions [MRG +1] MNT TST Use assert_raises instead of legacy constructions Sep 13, 2018
@jorisvandenbossche jorisvandenbossche merged commit ec69171 into scikit-learn:master Sep 13, 2018
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Sep 17, 2018
@rth rth deleted the assert-raises branch January 20, 2019 09:25
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
0