MCPcopy
hub / github.com/dask/dask / test_concatenate

Function test_concatenate

dask/array/tests/test_array_core.py:748–790  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

746
747
748def test_concatenate():
749 a, b, c = (
750 Array(
751 graph_from_arraylike(object(), chunks=(2, 3), shape=(4, 6), name=name),
752 name,
753 chunks=(2, 3),
754 dtype="f8",
755 shape=(4, 6),
756 )
757 for name in "ABC"
758 )
759
760 x = concatenate([a, b, c], axis=0)
761
762 assert x.shape == (12, 6)
763 assert x.chunks == ((2, 2, 2, 2, 2, 2), (3, 3))
764 assert x.dask[(x.name, 0, 1)] == ("A", 0, 1)
765 assert x.dask[(x.name, 5, 0)] == ("C", 1, 0)
766 assert same_keys(x, concatenate([a, b, c], axis=0))
767
768 y = concatenate([a, b, c], axis=1)
769
770 assert y.shape == (4, 18)
771 assert y.chunks == ((2, 2), (3, 3, 3, 3, 3, 3))
772 assert y.dask[(y.name, 1, 0)] == ("A", 1, 0)
773 assert y.dask[(y.name, 1, 5)] == ("C", 1, 1)
774 assert same_keys(y, concatenate([a, b, c], axis=1))
775
776 assert set(b.dask.keys()).issubset(y.dask.keys())
777
778 z = concatenate([a], axis=0)
779
780 assert z.shape == a.shape
781 assert z.chunks == a.chunks
782 assert z.dask == a.dask
783 assert z is a
784
785 assert (
786 concatenate([a, b, c], axis=-1).chunks == concatenate([a, b, c], axis=1).chunks
787 )
788
789 pytest.raises(ValueError, lambda: concatenate([]))
790 pytest.raises(ValueError, lambda: concatenate([a, b, c], axis=2))
791
792
793@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 6

ArrayClass · 0.90
graph_from_arraylikeFunction · 0.90
concatenateFunction · 0.90
same_keysFunction · 0.90
setClass · 0.85
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…