MCPcopy
hub / github.com/numpy/numpy / test_nested

Method test_nested

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

Source from the content-addressed store, hash-verified

713 assert_equal(result, expected)
714
715 def test_nested(self, block):
716 one = np.array([1, 1, 1])
717 two = np.array([[2, 2, 2], [2, 2, 2], [2, 2, 2]])
718 three = np.array([3, 3, 3])
719 four = np.array([4, 4, 4])
720 five = np.array(5)
721 six = np.array([6, 6, 6, 6, 6])
722 zero = np.zeros((2, 6))
723
724 result = block([
725 [
726 block([
727 [one],
728 [three],
729 [four]
730 ]),
731 two
732 ],
733 [five, six],
734 [zero]
735 ])
736 expected = np.array([[1, 1, 1, 2, 2, 2],
737 [3, 3, 3, 2, 2, 2],
738 [4, 4, 4, 2, 2, 2],
739 [5, 6, 6, 6, 6, 6],
740 [0, 0, 0, 0, 0, 0],
741 [0, 0, 0, 0, 0, 0]])
742
743 assert_equal(result, expected)
744
745 def test_3d(self, block):
746 a000 = np.ones((2, 2, 2), int) * 1

Callers

nothing calls this directly

Calls 2

blockFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected