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

Method test_block_complicated

numpy/core/tests/test_shape_base.py:618–640  ·  view source on GitHub ↗
(self, block)

Source from the content-addressed store, hash-verified

616 assert_equal(expected, result)
617
618 def test_block_complicated(self, block):
619 # a bit more complicated
620 one_2d = np.array([[1, 1, 1]])
621 two_2d = np.array([[2, 2, 2]])
622 three_2d = np.array([[3, 3, 3, 3, 3, 3]])
623 four_1d = np.array([4, 4, 4, 4, 4, 4])
624 five_0d = np.array(5)
625 six_1d = np.array([6, 6, 6, 6, 6])
626 zero_2d = np.zeros((2, 6))
627
628 expected = np.array([[1, 1, 1, 2, 2, 2],
629 [3, 3, 3, 3, 3, 3],
630 [4, 4, 4, 4, 4, 4],
631 [5, 6, 6, 6, 6, 6],
632 [0, 0, 0, 0, 0, 0],
633 [0, 0, 0, 0, 0, 0]])
634
635 result = block([[one_2d, two_2d],
636 [three_2d],
637 [four_1d],
638 [five_0d, six_1d],
639 [zero_2d]])
640 assert_equal(result, expected)
641
642 def test_nested(self, block):
643 one = np.array([1, 1, 1])

Callers

nothing calls this directly

Calls 2

blockFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected