assamtest

mocha-style tests for python
git clone https://git.ce9e.org/assamtest.git

commit
1a4ef15979e9893595edc6c58d64e845b4872348
parent
33353ffed0b2653146bcb4eee19ea17b587bb3b8
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-02-09 07:02
use expect.raises in fail decorator

Diffstat

M pyt/decorators.py 8 ++++----

1 files changed, 4 insertions, 4 deletions


diff --git a/pyt/decorators.py b/pyt/decorators.py

@@ -1,10 +1,10 @@
   -1     1 from .expect import expect
   -1     2 
   -1     3 
    1     4 def fail(fn):
    2     5 	def wrapper():
    3    -1 		try:
   -1     6 		with expect.raises(AssertionError):
    4     7 			fn()
    5    -1 		except AssertionError:
    6    -1 			return
    7    -1 		assert False, 'Expected to fail'
    8     8 	return wrapper
    9     9 
   10    10