Commit f1e39868 authored by valentin.emiya's avatar valentin.emiya

fix tests for __str__ methods

parent 2f5c5701
......@@ -664,6 +664,7 @@ class TestMadArray:
def test_str_repr(self):
# test when no data is missing
x = np.copy(self.x_float)
arr_str = np.ndarray.__str__(x)
......@@ -671,9 +672,10 @@ class TestMadArray:
string = 'MadArray, dtype=float64, 0 missing entries (0.0%)\n{}'
assert str(ma) == string.format(arr_str)
# test with missing data, float values
x[self.m] = np.nan
arr_str = np.ndarray.__str__(x)
arr_str = arr_str.replace('nan', 'x')
arr_str = arr_str.replace('nan', ' x')
ma = MadArray(self.x_float, self.m)
n_miss = np.count_nonzero(self.m)
......@@ -683,10 +685,11 @@ class TestMadArray:
string = '<MadArray at {}>'
assert repr(ma) == string.format(hex(id(ma)))
# test with missing data, float values from int
x = np.copy(self.x_int).astype(np.float64)
x[self.m] = np.nan
arr_str = np.ndarray.__str__(x)
arr_str = arr_str.replace('nan', 'x')
arr_str = arr_str.replace('nan', ' x')
arr_str = arr_str.replace('.', '')
ma = MadArray(self.x_int, self.m)
......
......@@ -791,7 +791,7 @@ class TestWaveform:
x = np.copy(self.x_mono)
x[self.m_mono] = np.nan
arr_str = np.ndarray.__str__(x)
arr_str = arr_str.replace('nan', 'x')
arr_str = arr_str.replace('nan', ' x')
n_miss = np.count_nonzero(self.m_mono)
exp_str = 'Waveform, fs={}Hz, length={}, dtype={}, {} missing '\
......
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