Commit 131e78e1 authored by valentin.emiya's avatar valentin.emiya

fix bug in resample test (not well understood)

parent 1c21cb56
Pipeline #606 passed with stage
in 26 seconds
......@@ -265,10 +265,12 @@ class TestWaveform:
# Floating values with ratios that are exact rationals
for (old_fs, new_fs) in [(1, 1.5), (0.5, 3), (100.1, 200.2)]:
print('Testing resampling {}/{}, signal length = {}'
.format(new_fs, old_fs, w.shape[0]))
w = Waveform(self.x_mono, fs=old_fs)
w.resample(fs=new_fs)
assert w.fs == new_fs
assert w.length == int(np.floor(new_fs * self.length / old_fs))
assert w.length == int(new_fs * self.length / old_fs)
# Floating values with ratios that are not well approximated
# by rationals
......@@ -279,7 +281,7 @@ class TestWaveform:
w.resample(fs=new_fs)
np.testing.assert_almost_equal(w.fs, new_fs)
np.testing.assert_almost_equal(
w.length, int(np.floor(new_fs * self.length / old_fs)))
w.length, int(new_fs * self.length / old_fs))
# Negative frequency sampling
with pytest.raises(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment