def test_split_rows(C, index, axis, first, second): expected = { 'top': numpy.array([ [ 0.0, 1.0, 2.0, 3.0, 4.0], [ 5.0, 6.0, 7.0, 8.0, 9.0], [10.0, 11.0, 12.0, 13.0, 14.0], ]), 'bottom': numpy.array([ [15., 16., 17., 18., 19.], [20., 21., 22., 23., 24.], ]), 'left': numpy.array([ [ 0., 1.], [ 5., 6.], [10., 11.], [15., 16.], [20., 21.], ]), 'right': numpy.array([ [ 2., 3., 4.], [ 7., 8., 9.], [12., 13., 14.], [17., 18., 19.], [22., 23., 24.], ]), } if first and second: a, b = core.split(C, index, axis) nptest.assert_array_equal(a, expected[first]) nptest.assert_array_equal(b, expected[second]) else: with raises(ValueError): left, right = core.split(C, index, axis=axis)
def test_split_at_right_edge_raises(self): left, right = core.split(self.C, 5, axis=1)
def test_split_axis1(self): left, right = core.split(self.C, 2, axis=1) nptest.assert_array_equal(left, self.known_left) nptest.assert_array_equal(right, self.known_right)
def test_split_at_bottom_edge_raises(self): left, right = core.split(self.C, 5, axis=0)
def test_split_axis0(self): top, bottom = core.split(self.C, 3, axis=0) nptest.assert_array_equal(top, self.known_top) nptest.assert_array_equal(bottom, self.known_bottom)