From 7e7ccc5abc01adc260e2630773e6589a7bec5894 Mon Sep 17 00:00:00 2001 From: ahmadtourei Date: Thu, 23 Jan 2025 15:13:15 -0700 Subject: [PATCH] lint --- dascore/viz/spectrogram.py | 2 +- tests/test_viz/test_spectrogram.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dascore/viz/spectrogram.py b/dascore/viz/spectrogram.py index e61ea684..95293e6b 100644 --- a/dascore/viz/spectrogram.py +++ b/dascore/viz/spectrogram.py @@ -84,7 +84,7 @@ def spectrogram( spec = _spec.aggregate(other_dim, method="mean").squeeze() else: raise ValueError( - f"The aggr_domain '{aggr_domain}' should be either 'time' or 'frequency'." + f"The aggr_domain '{aggr_domain}' should be 'time' or 'frequency.'" ) else: spec = patch.spectrogram(dim) diff --git a/tests/test_viz/test_spectrogram.py b/tests/test_viz/test_spectrogram.py index 2fdefa5d..27f2a168 100644 --- a/tests/test_viz/test_spectrogram.py +++ b/tests/test_viz/test_spectrogram.py @@ -9,18 +9,21 @@ def test_get_other_dim_valid(): + """Ensure _get_other_dim correctly returns the other dimension.""" dims = ("time", "distance") assert _get_other_dim("time", dims) == "distance" assert _get_other_dim("distance", dims) == "time" def test_get_other_dim_invalid(): + """Ensure _get_other_dim raises a ValueError.""" dims = ("time", "distance") with pytest.raises(ValueError, match="not in patch's dimensions"): _get_other_dim("frequency", dims) def test_get_other_dim_invalid_dim_type(): + """Ensure _get_other_dim raises a TypeError when dim is not a string.""" dims = ("time", "distance") with pytest.raises(TypeError, match="Expected 'dim' to be a string"): _get_other_dim(("time",), dims) @@ -53,11 +56,11 @@ def test_invalid_aggr_domain(self, random_patch): def test_invalid_patch_dims(self, random_patch): """Ensure ValueError is raised for patches with invalid dimensions.""" - patch_3D = random_patch.correlate(distance=[0, 1]) + patch_3d = random_patch.correlate(distance=[0, 1]) with pytest.raises( ValueError, match="Can only make spectogram of 1D or 2D patches" ): - patch_3D.viz.spectrogram(dim="distance") + patch_3d.viz.spectrogram(dim="distance") def test_1d_patch(self, random_patch): """Ensure spectrogram works with 1D patch."""