[bugfix] test raised different Exception than planned
This commit is contained in:
parent
c3a2ef5022
commit
452f2a2e18
@ -174,12 +174,12 @@ class XCorrPickCorrection:
|
|||||||
msg = f"Trace {tr.id} starts too late. Decrease t_before or cc_maxlag."
|
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},'
|
logging.debug(f'start: {start}, t_before: {self.t_before}, cc_maxlag: {self.cc_maxlag},'
|
||||||
f'pick: {pick}')
|
f'pick: {pick}')
|
||||||
raise Exception(msg)
|
raise ValueError(msg)
|
||||||
if tr.stats.endtime < end:
|
if tr.stats.endtime < end:
|
||||||
msg = f"Trace {tr.id} ends too early. Deacrease t_after or cc_maxlag."
|
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},'
|
logging.debug(f'end: {end}, t_after: {self.t_after}, cc_maxlag: {self.cc_maxlag},'
|
||||||
f'pick: {pick}')
|
f'pick: {pick}')
|
||||||
raise Exception(msg)
|
raise ValueError(msg)
|
||||||
|
|
||||||
# apply signal processing and take correct slice of data
|
# apply signal processing and take correct slice of data
|
||||||
return tr.slice(start, end)
|
return tr.slice(start, end)
|
||||||
|
@ -49,12 +49,12 @@ class TestXCorrPickCorrection():
|
|||||||
test_trace = self.trace1
|
test_trace = self.trace1
|
||||||
pick_time = self.tpick1
|
pick_time = self.tpick1
|
||||||
|
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(ValueError):
|
||||||
xcpc = XCorrPickCorrection(UTCDateTime(), Trace(), UTCDateTime(), Trace(),
|
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)
|
xcpc.slice_trace(test_trace, pick_time)
|
||||||
|
|
||||||
with pytest.raises(Exception):
|
with pytest.raises(ValueError):
|
||||||
xcpc = XCorrPickCorrection(UTCDateTime(), Trace(), UTCDateTime(), Trace(),
|
xcpc = XCorrPickCorrection(UTCDateTime(), Trace(), UTCDateTime(), Trace(),
|
||||||
t_before=self.t_before, t_after=self.t_after + 50, cc_maxlag=self.cc_maxlag)
|
t_before=self.t_before, t_after=self.t_after + 50, cc_maxlag=self.cc_maxlag)
|
||||||
xcpc.slice_trace(test_trace, pick_time)
|
xcpc.slice_trace(test_trace, pick_time)
|
||||||
|
Loading…
Reference in New Issue
Block a user