Skip to content

Commit

Permalink
Restore Python 3.8 compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Oct 31, 2021
1 parent c5f3e61 commit 866a1b3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jaraco/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ def raises(self, func, *, _test=bool):
Wrap func and replace the result with the truth
value of the trap.
>>> @ExceptionTrap(ValueError).raises
# support Python 3.8 syntax
>>> raises = ExceptionTrap(ValueError).raises
>>> @raises
... def fail():
... raise ValueError('failed')
>>> fail()
Expand All @@ -175,7 +177,9 @@ def wrapper(*args, **kwargs):

def passes(self, func):
"""
>>> @ExceptionTrap(ValueError).passes
# support Python 3.8 syntax
>>> passes = ExceptionTrap(ValueError).passes
>>> @passes
... def fail():
... raise ValueError('failed')
>>> fail()
Expand Down

0 comments on commit 866a1b3

Please sign in to comment.