Exemplo n.º 1
0
def test_guess_chunks():
    shapes = (
        (100, ),
        (100, 100),
        (1000000, ),
        (1000000000, ),
        (10000000000000000000000, ),
        (10000, 10000),
        (10000000, 1000),
        (1000, 10000000),
        (10000000, 1000, 2),
        (1000, 10000000, 2),
        (10000, 10000, 10000),
        (100000, 100000, 100000),
        (1000000000, 1000000000, 1000000000),
        (0, ),
        (0, 0),
        (10, 0),
        (0, 10),
        (1, 2, 0, 4, 5),
    )
    for shape in shapes:
        chunks = guess_chunks(shape, 1)
        assert_is_instance(chunks, tuple)
        eq(len(chunks), len(shape))
        # doesn't make any sense to allow chunks to have zero length dimension
        assert all([0 < c <= max(s, 1) for c, s in zip(chunks, shape)])

    # ludicrous itemsize
    chunks = guess_chunks((1000000, ), 40000000000)
    assert_is_instance(chunks, tuple)
    eq((1, ), chunks)
Exemplo n.º 2
0
def test_guess_chunks():
    shapes = (
        (100, ),
        (100, 100),
        (1000000, ),
        (10000, 10000),
        (10000000, 1000),
        (1000, 10000000),
        (10000000, 1000, 2),
        (1000, 10000000, 2),
        (10000, 10000, 10000),
        (100000, 100000, 100000),
    )
    for shape in shapes:
        chunks = guess_chunks(shape, 1)
        assert_is_instance(chunks, tuple)
        eq(len(chunks), len(shape))
        assert all([c <= s for c, s in zip(chunks, shape)])

    # ludicrous itemsize
    chunks = guess_chunks((1000000, ), 40000000)
    assert_is_instance(chunks, tuple)
    eq((1, ), chunks)
Exemplo n.º 3
0
def test_guess_chunks():
    shapes = (
        (100,),
        (100, 100),
        (1000000,),
        (10000, 10000),
        (10000000, 1000),
        (1000, 10000000),
        (10000000, 1000, 2),
        (1000, 10000000, 2),
        (10000, 10000, 10000),
        (100000, 100000, 100000),
    )
    for shape in shapes:
        chunks = guess_chunks(shape, 1)
        assert_is_instance(chunks, tuple)
        eq(len(chunks), len(shape))
        assert all([c <= s for c, s in zip(chunks, shape)])

    # ludicrous itemsize
    chunks = guess_chunks((1000000,), 40000000)
    assert_is_instance(chunks, tuple)
    eq((1,), chunks)