TST Use assert_raises "match" parameter instead of the "message" parameter.#9264
Merged
Conversation
larsoner
reviewed
Sep 13, 2018
larsoner
left a comment
Member
There was a problem hiding this comment.
One minor gripe otherwise LGTM assuming tests pass. Thanks for fixing these.
| pass | ||
| else: | ||
| raise AssertionError('TypeError not raised.') | ||
| assert_raises(TypeError, _distr3_gen, **dict(name='dummy')) |
Member
There was a problem hiding this comment.
This should be the same as (more simply) passing name='dummy' directly rather than wrapping in a **dict(name='dummy').
08a1091 to
803bc52
Compare
Contributor
Author
|
Thanks for the review! I addressed your comment. There is a failure in one Travis CI build in |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It appears there are several occurrences in tests where the
matchparameter should have been used inpytest.raisesinstead of themessageparameter.The former checks the obtained exception message against a pattern, while the latter is the message printed on failure.
The consequence is that these tests could have been passing while they shouldn't have. Will open an issue about this confusing terminology in pytest.
This also refactors a few tests to use
assert_raisesinstead of more complicated constructions and removes one outdated call tounittest.TestCase.failwhich is no longer used as a base class for tests.