Skip to content

Commit

Permalink
[test] Fix failing warning assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
maestroque committed Aug 25, 2024
1 parent 612c616 commit e528d21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions phys2denoise/metrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def print_metric_call(metric, args):

msg = f"{msg}\n"

LGR.info(msg)
logger.info(msg)


def mirrorpad_1d(arr, buffer=250):
Expand All @@ -62,7 +62,11 @@ def mirrorpad_1d(arr, buffer=250):
post_mirror = np.take(mirror, idx, axis=0)
except IndexError:
len(arr)
LGR.warning(
# LGR.warning(
# f"Requested buffer size ({buffer}) is longer than input array length "
# f"({len(arr)}). Fixing buffer size to array length."
# )
logger.warning(
f"Requested buffer size ({buffer}) is longer than input array length "
f"({len(arr)}). Fixing buffer size to array length."
)
Expand Down
6 changes: 3 additions & 3 deletions phys2denoise/tests/test_metrics_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def test_mirrorpad(short_arr):
assert all(arr_mirror == expected_arr_mirror)


def test_mirrorpad_exception(short_arr):
def test_mirrorpad_exception(short_arr, caplog):
"""When passing array that is too short to perform mirrorpadding, the
function should give an error."""
arr = np.array(short_arr)
with pytest.raises(IndexError):
arr_mirror = mirrorpad_1d(short_arr)
arr_mirror = mirrorpad_1d(arr)
assert caplog.text.count("Fixing buffer size to array length.") > 0


def test_rms_envelope():
Expand Down

0 comments on commit e528d21

Please sign in to comment.