MCPcopy Index your code
hub / github.com/dask/dask / test_dot

Function test_dot

dask/dataframe/tests/test_dataframe.py:4907–4933  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4905
4906
4907def test_dot():
4908 s1 = pd.Series([1, 2, 3, 4])
4909 s2 = pd.Series([4, 5, 6, 6])
4910 df = pd.DataFrame({"one": s1, "two": s2})
4911
4912 dask_s1 = dd.from_pandas(s1, npartitions=1)
4913 dask_df = dd.from_pandas(df, npartitions=1)
4914 dask_s2 = dd.from_pandas(s2, npartitions=1)
4915
4916 assert_eq(s1.dot(s2), dask_s1.dot(dask_s2))
4917 assert_eq(s1.dot(df), dask_s1.dot(dask_df))
4918
4919 # With partitions
4920 partitioned_s1 = dd.from_pandas(s1, npartitions=2)
4921 partitioned_df = dd.from_pandas(df, npartitions=2)
4922 partitioned_s2 = dd.from_pandas(s2, npartitions=2)
4923
4924 assert_eq(s1.dot(s2), partitioned_s1.dot(partitioned_s2))
4925 assert_eq(s1.dot(df), partitioned_s1.dot(partitioned_df))
4926
4927 # Test passing meta kwarg
4928 res = dask_s1.dot(dask_df, meta=pd.Series([1], name="test_series")).compute()
4929 assert res.name == "test_series"
4930
4931 # Test validation of second operand
4932 with pytest.raises(TypeError):
4933 dask_s1.dot(da.array([1, 2, 3, 4]))
4934
4935
4936def test_dot_nan():

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
dotMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…