MCPcopy Create free account
hub / github.com/dask/dask / test_concatenate_unknown_axes

Function test_concatenate_unknown_axes

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

Source from the content-addressed store, hash-verified

803
804
805def test_concatenate_unknown_axes():
806 pd = pytest.importorskip("pandas")
807 dd = pytest.importorskip("dask.dataframe")
808
809 a_df = pd.DataFrame({"x": np.arange(12)})
810 b_df = pd.DataFrame({"y": np.arange(12) * 10})
811
812 a_ddf = dd.from_pandas(a_df, sort=False, npartitions=3)
813 b_ddf = dd.from_pandas(b_df, sort=False, npartitions=3)
814
815 a_x = a_ddf.values
816 b_x = b_ddf.values
817
818 assert np.isnan(a_x.shape[0])
819 assert np.isnan(b_x.shape[0])
820
821 da.concatenate([a_x, b_x], axis=0) # works fine
822
823 with pytest.raises(ValueError) as exc_info:
824 da.concatenate([a_x, b_x], axis=1) # unknown chunks
825
826 assert "nan" in str(exc_info.value)
827 assert "allow_unknown_chunksize" in str(exc_info.value)
828
829 c_x = da.concatenate(
830 [a_x, b_x], axis=1, allow_unknown_chunksizes=True
831 ) # unknown chunks
832
833 assert_eq(c_x, np.concatenate([a_df.values, b_df.values], axis=1))
834
835
836def test_concatenate_flatten():

Callers

nothing calls this directly

Calls 2

assert_eqFunction · 0.90
arangeMethod · 0.45

Tested by

no test coverage detected