MCPcopy Create free account
hub / github.com/numpy/numpy / assert_array_compare

Function assert_array_compare

numpy/ma/testutils.py:195–217  ·  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

193
194
195def assert_array_compare(comparison, x, y, err_msg='', verbose=True, header='',
196 fill_value=True):
197 """
198 Asserts that comparison between two masked arrays is satisfied.
199
200 The comparison is elementwise.
201
202 """
203 # Allocate a common mask and refill
204 m = mask_or(getmask(x), getmask(y))
205 x = masked_array(x, copy=False, mask=m, keep_mask=False, subok=False)
206 y = masked_array(y, copy=False, mask=m, keep_mask=False, subok=False)
207 if ((x is masked) and not (y is masked)) or \
208 ((y is masked) and not (x is masked)):
209 msg = build_err_msg([x, y], err_msg=err_msg, verbose=verbose,
210 header=header, names=('x', 'y'))
211 raise ValueError(msg)
212 # OK, now run the basic tests on filled versions
213 return np.testing.assert_array_compare(comparison,
214 x.filled(fill_value),
215 y.filled(fill_value),
216 err_msg=err_msg,
217 verbose=verbose, header=header)
218
219
220def 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 5

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

Tested by

no test coverage detected