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

Method test_block_complicated

numpy/_core/tests/test_shape_base.py:691–713  ·  view source on GitHub ↗
(self, block)

Source from the content-addressed store, hash-verified

689 assert_equal(expected, result)
690
691 def test_block_complicated(self, block):
692 # a bit more complicated
693 one_2d = np.array([[1, 1, 1]])
694 two_2d = np.array([[2, 2, 2]])
695 three_2d = np.array([[3, 3, 3, 3, 3, 3]])
696 four_1d = np.array([4, 4, 4, 4, 4, 4])
697 five_0d = np.array(5)
698 six_1d = np.array([6, 6, 6, 6, 6])
699 zero_2d = np.zeros((2, 6))
700
701 expected = np.array([[1, 1, 1, 2, 2, 2],
702 [3, 3, 3, 3, 3, 3],
703 [4, 4, 4, 4, 4, 4],
704 [5, 6, 6, 6, 6, 6],
705 [0, 0, 0, 0, 0, 0],
706 [0, 0, 0, 0, 0, 0]])
707
708 result = block([[one_2d, two_2d],
709 [three_2d],
710 [four_1d],
711 [five_0d, six_1d],
712 [zero_2d]])
713 assert_equal(result, expected)
714
715 def test_nested(self, block):
716 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