Skip to content

Commit

Permalink
fixes grappa-py#68
Browse files Browse the repository at this point in the history
  • Loading branch information
sgissinger committed Jan 21, 2021
1 parent bef2355 commit bf6b6e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grappa/operators/raises.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def fn():
def after_success(self, obj, *keys):
message = getattr(self.value, 'message', None)

if not message:
if not message and self.value:
message = ' '.join([str(item) for item in self.value.args])

self.ctx.subject = message
Expand Down
2 changes: 2 additions & 0 deletions tests/operators/raises_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def error_with_params(foo_param):
with pytest.raises(AssertionError):
no_error | should.raise_error(AssertionError)

no_error | should.do_not.raise_error(AssertionError)

def test_raises_with_message_redirection(should):
def error():
Expand All @@ -41,6 +42,7 @@ def env_error():
raise EnvironmentError(3501, 'bar')

error | should.raise_error(AssertionError) > should.equal('foo')
error | should.raise_error(AssertionError) > should.do_not.equal('fooed')

error | should.raise_error(AssertionError) > should.contain('fo')

Expand Down

0 comments on commit bf6b6e0

Please sign in to comment.