def METHOD_NAME():
    """test for random.random_cp"""
    shape = (10, 11, 12)
    rank = 4
    tensor = random_cp(shape, rank, full=True)
    assert T.shape(tensor) == shape
    for i in range(T.ndim(tensor)):
        assert_equal(matrix_rank(T.to_numpy(unfold(tensor, i)), tol=1e-6), rank)
    weights, factors = random_cp(shape, rank, full=False)
    for i, factor in enumerate(factors):
        assert_equal(
            factor.shape,
            (shape[i], rank),
            err_msg=f"{i}-th factor has shape {factor.shape}, expected {(shape[i], rank)}",
        )
    # tests that the columns of each factor matrix are indeed orthogonal
    weights, factors = random_cp(shape, rank, full=False, orthogonal=True)
    for i, factor in enumerate(factors):
        for j in range(rank):
            for k in range(j):
                # (See issue #40)
                dot_product = T.dot(factor[:, j], factor[:, k])
                try:
                    T.shape(dot_product)
                except:
                    dot_product = T.tensor([dot_product], **T.context(weights))
                assert_array_almost_equal(dot_product, T.tensor([0]))
    with np.testing.assert_raises(ValueError):
        shape = (10, 11, 12)
        rank = 11
        _ = random_cp(shape, rank, orthogonal=True)