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)
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)
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)
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)
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)
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)
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)