MCPcopy Index your code
hub / github.com/numpy/numpy / test_testPut

Method test_testPut

numpy/ma/tests/test_old_ma.py:371–391  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

369 assert_(eq(y5, y6))
370
371 def test_testPut(self):
372 # Test of put
373 d = arange(5)
374 n = [0, 0, 0, 1, 1]
375 m = make_mask(n)
376 m2 = m.copy()
377 x = array(d, mask=m)
378 assert_(x[3] is masked)
379 assert_(x[4] is masked)
380 x[[1, 4]] = [10, 40]
381 assert_(x._mask is m)
382 assert_(x[3] is masked)
383 assert_(x[4] is not masked)
384 assert_(eq(x, [0, 10, 2, -1, 40]))
385
386 x = array(d, mask=m2, copy=True)
387 x.put([0, 1, 2], [-1, 100, 200])
388 assert_(x._mask is not m2)
389 assert_(x[3] is masked)
390 assert_(x[4] is masked)
391 assert_(eq(x, [-1, 100, 200, 0, 0]))
392
393 def test_testPut2(self):
394 # Test of put

Callers

nothing calls this directly

Calls 6

make_maskFunction · 0.90
arrayFunction · 0.90
assert_Function · 0.90
eqFunction · 0.85
putMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected