Beispiel #1
0
def test_get_array_ranges():
    x = np.array([3, 9, 2, 1, 5, 4, 7, 7, 8, 6])
    for n_chunks in range(2, 5):
        left = naive.get_array_ranges(x, n_chunks)

        right = core._get_array_ranges(x, n_chunks)
        npt.assert_almost_equal(left, right)
Beispiel #2
0
def test_get_array_ranges():
    x = np.array([3, 9, 2, 1, 5, 4, 7, 7, 8, 6])
    for n_chunks in range(2, 5):
        ref = naive.get_array_ranges(x, n_chunks)

        comp = core._get_array_ranges(x, n_chunks)
        npt.assert_almost_equal(ref, comp)
Beispiel #3
0
def test_get_array_ranges():
    x = np.array([3, 9, 2, 1, 5, 4, 7, 7, 8, 6], dtype=np.int64)
    for n_chunks in range(2, 5):
        ref = naive.get_array_ranges(x, n_chunks, False)

        cmp = core._get_array_ranges(x, n_chunks, False)
        npt.assert_almost_equal(ref, cmp)
Beispiel #4
0
def test_get_array_ranges_exhausted_truncated():
    x = np.array([3, 3, 3, 11, 11, 11])
    n_chunks = 6

    left = naive.get_array_ranges(x, n_chunks, truncate=True)

    right = core._get_array_ranges(x, n_chunks, truncate=True)
    npt.assert_almost_equal(left, right)
Beispiel #5
0
def test_get_array_ranges_exhausted_truncated():
    x = np.array([3, 3, 3, 11, 11, 11])
    n_chunks = 6

    ref = naive.get_array_ranges(x, n_chunks, truncate=True)

    comp = core._get_array_ranges(x, n_chunks, truncate=True)
    npt.assert_almost_equal(ref, comp)
Beispiel #6
0
def test_get_array_ranges_empty_array():
    x = np.array([], dtype=np.int64)
    n_chunks = 6

    ref = naive.get_array_ranges(x, n_chunks, False)

    comp = core._get_array_ranges(x, n_chunks, False)
    npt.assert_almost_equal(ref, comp)
Beispiel #7
0
def test_get_array_ranges_exhausted():
    x = np.array([3, 3, 3, 11, 11, 11], dtype=np.int64)
    n_chunks = 6

    ref = naive.get_array_ranges(x, n_chunks, False)

    cmp = core._get_array_ranges(x, n_chunks, False)
    npt.assert_almost_equal(ref, cmp)