def test_bin_split():

	dm = DataMatrix(length=4)
	dm.a = range(4)
	dm = ops.shuffle(dm)
	dm1, dm2 = ops.bin_split(dm.a, 2)
	check_col(dm1.a, [0,1])
	check_col(dm2.a, [2,3])
	dm1, dm2, dm3 = ops.bin_split(dm.a, 3)
	check_col(dm1.a, [0])
	check_col(dm2.a, [1])
	check_col(dm3.a, [2,3])
	dm1, = ops.bin_split(dm.a, 1)
	check_col(dm1.a, [0,1,2,3])
	@raises(ValueError)
	def _():
		x, = ops.bin_split(dm.a, 5)
	_()
def test_bin_split():

    dm = DataMatrix(length=4)
    dm.a = range(4)
    dm = ops.shuffle(dm)
    dm1, dm2 = ops.bin_split(dm.a, 2)
    check_col(dm1.a, [0, 1])
    check_col(dm2.a, [2, 3])
    dm1, dm2, dm3 = ops.bin_split(dm.a, 3)
    check_col(dm1.a, [0])
    check_col(dm2.a, [1])
    check_col(dm3.a, [2, 3])
    dm1, = ops.bin_split(dm.a, 1)
    check_col(dm1.a, [0, 1, 2, 3])

    def _():
        with pytest.raises(ValueError):
            x, = ops.bin_split(dm.a, 5)

    _()
 def _():
     with pytest.raises(ValueError):
         x, = ops.bin_split(dm.a, 5)
	def _():
		x, = ops.bin_split(dm.a, 5)
示例#5
0
 def _():
     x, = ops.bin_split(dm.a, 5)