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

Method test_nested

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

Source from the content-addressed store, hash-verified

640 assert_equal(result, expected)
641
642 def test_nested(self, block):
643 one = np.array([1, 1, 1])
644 two = np.array([[2, 2, 2], [2, 2, 2], [2, 2, 2]])
645 three = np.array([3, 3, 3])
646 four = np.array([4, 4, 4])
647 five = np.array(5)
648 six = np.array([6, 6, 6, 6, 6])
649 zero = np.zeros((2, 6))
650
651 result = block([
652 [
653 block([
654 [one],
655 [three],
656 [four]
657 ]),
658 two
659 ],
660 [five, six],
661 [zero]
662 ])
663 expected = np.array([[1, 1, 1, 2, 2, 2],
664 [3, 3, 3, 2, 2, 2],
665 [4, 4, 4, 2, 2, 2],
666 [5, 6, 6, 6, 6, 6],
667 [0, 0, 0, 0, 0, 0],
668 [0, 0, 0, 0, 0, 0]])
669
670 assert_equal(result, expected)
671
672 def test_3d(self, block):
673 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