[bugfix] test raised different Exception than planned

This commit is contained in:
Marcel Paffrath 2024-08-08 14:41:16 +02:00
parent c3a2ef5022
commit 452f2a2e18
2 changed files with 5 additions and 5 deletions

View File

@ -174,12 +174,12 @@ class XCorrPickCorrection:
msg = f"Trace {tr.id} starts too late. Decrease t_before or cc_maxlag."
logging.debug(f'start: {start}, t_before: {self.t_before}, cc_maxlag: {self.cc_maxlag},'
f'pick: {pick}')
raise Exception(msg)
raise ValueError(msg)
if tr.stats.endtime < end:
msg = f"Trace {tr.id} ends too early. Deacrease t_after or cc_maxlag."
logging.debug(f'end: {end}, t_after: {self.t_after}, cc_maxlag: {self.cc_maxlag},'
f'pick: {pick}')
raise Exception(msg)
raise ValueError(msg)
# apply signal processing and take correct slice of data
return tr.slice(start, end)

View File

@ -49,12 +49,12 @@ class TestXCorrPickCorrection():
test_trace = self.trace1
pick_time = self.tpick1
with pytest.raises(Exception):
with pytest.raises(ValueError):
xcpc = XCorrPickCorrection(UTCDateTime(), Trace(), UTCDateTime(), Trace(),
t_before=self.t_before - 20, t_after=self.t_after, cc_maxlag=self.cc_maxlag)
t_before=self.t_before + 20, t_after=self.t_after, cc_maxlag=self.cc_maxlag)
xcpc.slice_trace(test_trace, pick_time)
with pytest.raises(Exception):
with pytest.raises(ValueError):
xcpc = XCorrPickCorrection(UTCDateTime(), Trace(), UTCDateTime(), Trace(),
t_before=self.t_before, t_after=self.t_after + 50, cc_maxlag=self.cc_maxlag)
xcpc.slice_trace(test_trace, pick_time)