Skip to content

Commit fdc06cc

Browse files
committed
fail if exception is not raised
1 parent c1ba035 commit fdc06cc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/xSTIR/pSTIR/tests/test_algebra.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,17 @@ def wrapper(self, func):
118118
func(self)
119119
except Exception as e:
120120
print (f"Caught exception in {func.__name__}: {e}")
121-
121+
return
122+
raise AssertionError(f"Expected exception in {func.__name__} but none was raised.")
123+
122124
for m in a:
123125
self.__setattr__(m[0], functools.partial(wrapper, self, m[1]))
124126

125-
self.__setattr__('setUp', functools.partial(wrapper, self, self.setUp))
127+
self.__setattr__('setUp', functools.partial(wrapper, self, self.setUp))
128+
129+
def test_division_by_datacontainer_zero(self):
130+
'''Currently cSIRF does not throw any error whilst dividing a datacontainer with zero.
131+
The method is set to just pass in the TestSTIRAcquisitionDataSubsetAlgebra base class.
132+
133+
For storage_scheme 'file' we want to raise an error though.'''
134+
raise RuntimeError("Raising as expected for storage_scheme file, however cSIRF does not throw.")

0 commit comments

Comments
 (0)