MCPcopy
hub / github.com/numpy/numpy / test_basic

Method test_basic

numpy/lib/tests/test_function_base.py:602–616  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

600class TestInsert:
601
602 def test_basic(self):
603 a = [1, 2, 3]
604 assert_equal(insert(a, 0, 1), [1, 1, 2, 3])
605 assert_equal(insert(a, 3, 1), [1, 2, 3, 1])
606 assert_equal(insert(a, [1, 1, 1], [1, 2, 3]), [1, 1, 2, 3, 2, 3])
607 assert_equal(insert(a, 1, [1, 2, 3]), [1, 1, 2, 3, 2, 3])
608 assert_equal(insert(a, [1, -1, 3], 9), [1, 9, 2, 9, 3, 9])
609 assert_equal(insert(a, slice(-1, None, -1), 9), [9, 1, 9, 2, 9, 3])
610 assert_equal(insert(a, [-1, 1, 3], [7, 8, 9]), [1, 8, 2, 7, 3, 9])
611 b = np.array([0, 1], dtype=np.float64)
612 assert_equal(insert(b, 0, b[0]), [0., 0., 1.])
613 assert_equal(insert(b, [], []), b)
614 assert_equal(insert(a, np.array([True] * 4), 9), [9, 1, 9, 2, 9, 3, 9])
615 assert_equal(insert(a, np.array([True, False, True, False]), 9),
616 [9, 1, 2, 9, 3])
617
618 def test_multidim(self):
619 a = [[1, 1, 1]]

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
insertFunction · 0.90
sliceFunction · 0.85

Tested by

no test coverage detected