Asserts that comparison between two masked arrays is satisfied. The comparison is elementwise.
(comparison, x, y, err_msg='', verbose=True, header='',
fill_value=True)
| 199 | |
| 200 | |
| 201 | def assert_array_compare(comparison, x, y, err_msg='', verbose=True, header='', |
| 202 | fill_value=True): |
| 203 | """ |
| 204 | Asserts that comparison between two masked arrays is satisfied. |
| 205 | |
| 206 | The comparison is elementwise. |
| 207 | |
| 208 | """ |
| 209 | # Allocate a common mask and refill |
| 210 | m = mask_or(getmask(x), getmask(y)) |
| 211 | x = masked_array(x, copy=False, mask=m, keep_mask=False, subok=False) |
| 212 | y = masked_array(y, copy=False, mask=m, keep_mask=False, subok=False) |
| 213 | if ((x is masked) and not (y is masked)) or \ |
| 214 | ((y is masked) and not (x is masked)): |
| 215 | msg = build_err_msg([x, y], err_msg=err_msg, verbose=verbose, |
| 216 | header=header, names=('x', 'y')) |
| 217 | raise ValueError(msg) |
| 218 | # OK, now run the basic tests on filled versions |
| 219 | return np.testing.assert_array_compare(comparison, |
| 220 | x.filled(fill_value), |
| 221 | y.filled(fill_value), |
| 222 | err_msg=err_msg, |
| 223 | verbose=verbose, header=header) |
| 224 | |
| 225 | |
| 226 | def assert_array_equal(x, y, err_msg='', verbose=True): |
no test coverage detected
searching dependent graphs…