MCPcopy
hub / github.com/numpy/numpy / assert_array_compare

Function assert_array_compare

numpy/ma/testutils.py:201–223  ·  view source on GitHub ↗

Asserts that comparison between two masked arrays is satisfied. The comparison is elementwise.

(comparison, x, y, err_msg='', verbose=True, header='',
                         fill_value=True)

Source from the content-addressed store, hash-verified

199
200
201def 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
226def assert_array_equal(x, y, err_msg='', verbose=True):

Callers 5

assert_array_equalFunction · 0.70
fail_if_array_equalFunction · 0.70
assert_array_lessFunction · 0.70

Calls 4

build_err_msgFunction · 0.90
mask_orFunction · 0.85
getmaskFunction · 0.85
filledMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…