MCPcopy
hub / github.com/dask/dask / test_repeat

Function test_repeat

dask/array/tests/test_creation.py:718–750  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

716
717
718def test_repeat():
719 x = np.random.random((10, 11, 13))
720 d = da.from_array(x, chunks=(4, 5, 3))
721
722 repeats = [0, 1, 2, 5]
723 axes = [-3, -2, -1, 0, 1, 2]
724
725 for r in repeats:
726 for a in axes:
727 assert_eq(x.repeat(r, axis=a), d.repeat(r, axis=a))
728
729 assert_eq(d.repeat(2, 0), da.repeat(d, 2, 0))
730
731 with pytest.raises(NotImplementedError):
732 da.repeat(d, np.arange(10))
733
734 with pytest.raises(NotImplementedError):
735 da.repeat(d, 2, None)
736
737 with pytest.raises(NotImplementedError):
738 da.repeat(d, 2)
739
740 for invalid_axis in [3, -4]:
741 with pytest.raises(ValueError):
742 da.repeat(d, 2, axis=invalid_axis)
743
744 x = np.arange(5)
745 d = da.arange(5, chunks=(2,))
746
747 assert_eq(x.repeat(3), d.repeat(3))
748
749 for r in [1, 2, 3, 4]:
750 assert all(concat(d.repeat(r).chunks))
751
752
753@pytest.mark.parametrize("reps", [2, (2, 2), (1, 2), (2, 1), (2, 3, 4, 0)])

Callers

nothing calls this directly

Calls 6

assert_eqFunction · 0.90
allFunction · 0.85
repeatMethod · 0.80
concatFunction · 0.50
randomMethod · 0.45
arangeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…