From 452f2a2e1848f710243b56e8d488af44214e9131 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 8 Aug 2024 14:41:16 +0200 Subject: [PATCH] [bugfix] test raised different Exception than planned --- pylot/correlation/pick_correlation_correction.py | 4 ++-- pylot/tests/test_pick_correlation_correction.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pylot/correlation/pick_correlation_correction.py b/pylot/correlation/pick_correlation_correction.py index 847cfe1c..8719ad75 100644 --- a/pylot/correlation/pick_correlation_correction.py +++ b/pylot/correlation/pick_correlation_correction.py @@ -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) diff --git a/pylot/tests/test_pick_correlation_correction.py b/pylot/tests/test_pick_correlation_correction.py index b7289de3..fb9311e5 100644 --- a/pylot/tests/test_pick_correlation_correction.py +++ b/pylot/tests/test_pick_correlation_correction.py @@ -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)