Commit e8570494 authored by Ronan Hamon's avatar Ronan Hamon

pep8 formatting

parent cc0c6967
Pipeline #464 passed with stage
in 2 minutes and 3 seconds
......@@ -109,7 +109,8 @@ def assert_clipping(x_clipped, x_ref, min_value, max_value):
def get_data(request):
request.cls.fs = np.random.choice(FS)
request.cls.length = np.random.randint(request.cls.fs*2, request.cls.fs * 3)
request.cls.length = np.random.randint(
request.cls.fs*2, request.cls.fs * 3)
request.cls.x_mono = np.random.rand(request.cls.length)
request.cls.x_mono_2 = np.random.rand(request.cls.length, 1)
......@@ -571,7 +572,7 @@ class TestWaveform:
with warnings.catch_warnings(record=True):
w2 = Waveform.from_wavfile(tmp_file.name).astype(dtype)
np.testing.assert_almost_equal(w2.to_np_array(),
np.testing.assert_almost_equal(w2.to_np_array(0),
w.to_np_array(0),
decimal=3)
assert w.fs == w2.fs
......@@ -978,7 +979,7 @@ class TestWaveform:
w3 = Waveform(x, fs=1 if self.fs > 1 else 44100)
ma = MadArray(x)
for operator in ['-', '-', '*', '/', '//']:
for operator in ['+', '-', '*', '/', '//']:
print('Operation: {}'.format(operator))
xs = eval('x {} x'.format(operator))
......@@ -986,7 +987,7 @@ class TestWaveform:
assert isinstance(ws, Waveform)
np.testing.assert_equal(ws, xs)
match='Waveforms do not have the same fs: \d+ and \d+'
match = 'Waveforms do not have the same fs: \d+ and \d+'
with pytest.raises(ValueError, match=match):
eval('w1 {} w3'.format(operator))
......@@ -994,10 +995,21 @@ class TestWaveform:
assert isinstance(ws, Waveform)
np.testing.assert_equal(ws, xs)
def test_eq(self):
x = self.x_mono
w1 = Waveform(x, fs=self.fs)
w2 = Waveform(x, fs=self.fs)
w3 = Waveform(x, fs=1 if self.fs > 1 else 44100)
assert np.all(w1 == w2)
match = 'Waveforms do not have the same fs: \d+ and \d+'
with pytest.raises(ValueError, match=match):
w1 == w3
assert w2.is_equal(w2)
assert not w1.is_equal(w3)
def test_fade(self):
......
......@@ -162,9 +162,9 @@ class Waveform(MadArray):
if isinstance(output, MadArray):
if len(inputs) == 2:
if (isinstance(inputs[0], Waveform) and
isinstance(inputs[1], Waveform) and
inputs[0].fs != inputs[1].fs):
if (isinstance(inputs[0], Waveform) and
isinstance(inputs[1], Waveform) and
inputs[0].fs != inputs[1].fs):
errmsg = 'Waveforms do not have the same fs: {} and {}'
raise ValueError(errmsg.format(inputs[0].fs, inputs[1].fs))
......
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