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

Method test_testPut2

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

Source from the content-addressed store, hash-verified

391 assert_(eq(x, [-1, 100, 200, 0, 0]))
392
393 def test_testPut2(self):
394 # Test of put
395 d = arange(5)
396 x = array(d, mask=[0, 0, 0, 0, 0])
397 z = array([10, 40], mask=[1, 0])
398 assert_(x[2] is not masked)
399 assert_(x[3] is not masked)
400 x[2:4] = z
401 assert_(x[2] is masked)
402 assert_(x[3] is not masked)
403 assert_(eq(x, [0, 1, 10, 40, 4]))
404
405 d = arange(5)
406 x = array(d, mask=[0, 0, 0, 0, 0])
407 y = x[2:4]
408 z = array([10, 40], mask=[1, 0])
409 assert_(x[2] is not masked)
410 assert_(x[3] is not masked)
411 y[:] = z
412 assert_(y[0] is masked)
413 assert_(y[1] is not masked)
414 assert_(eq(y, [10, 40]))
415 assert_(x[2] is masked)
416 assert_(x[3] is not masked)
417 assert_(eq(x, [0, 1, 10, 40, 4]))
418
419 def test_testMaPut(self):
420 _, _, _, _, _, _, ym, _, zm, _, _ = self._create_data()

Callers

nothing calls this directly

Calls 3

arrayFunction · 0.90
assert_Function · 0.90
eqFunction · 0.85

Tested by

no test coverage detected