Skip to content
Snippets Groups Projects
Commit f1e39868 authored by valentin.emiya's avatar valentin.emiya
Browse files

fix tests for __str__ methods

parent 2f5c5701
No related branches found
No related tags found
No related merge requests found
...@@ -664,6 +664,7 @@ class TestMadArray: ...@@ -664,6 +664,7 @@ class TestMadArray:
def test_str_repr(self): def test_str_repr(self):
# test when no data is missing
x = np.copy(self.x_float) x = np.copy(self.x_float)
arr_str = np.ndarray.__str__(x) arr_str = np.ndarray.__str__(x)
...@@ -671,6 +672,7 @@ class TestMadArray: ...@@ -671,6 +672,7 @@ class TestMadArray:
string = 'MadArray, dtype=float64, 0 missing entries (0.0%)\n{}' string = 'MadArray, dtype=float64, 0 missing entries (0.0%)\n{}'
assert str(ma) == string.format(arr_str) assert str(ma) == string.format(arr_str)
# test with missing data, float values
x[self.m] = np.nan x[self.m] = np.nan
arr_str = np.ndarray.__str__(x) arr_str = np.ndarray.__str__(x)
arr_str = arr_str.replace('nan', ' x') arr_str = arr_str.replace('nan', ' x')
...@@ -683,6 +685,7 @@ class TestMadArray: ...@@ -683,6 +685,7 @@ class TestMadArray:
string = '<MadArray at {}>' string = '<MadArray at {}>'
assert repr(ma) == string.format(hex(id(ma))) 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 = np.copy(self.x_int).astype(np.float64)
x[self.m] = np.nan x[self.m] = np.nan
arr_str = np.ndarray.__str__(x) arr_str = np.ndarray.__str__(x)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment