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

Function test_squeeze

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

Source from the content-addressed store, hash-verified

803
804
805def test_squeeze():
806 df = pd.DataFrame({"x": [1, 3, 6]})
807 df2 = pd.DataFrame({"x": [0]})
808 s = pd.Series({"test": 0, "b": 100})
809
810 ddf = dd.from_pandas(df, 3)
811 ddf2 = dd.from_pandas(df2, 3)
812 ds = dd.from_pandas(s, 2)
813
814 assert_eq(df.squeeze(), ddf.squeeze())
815 assert_eq(pd.Series([0], name="x"), ddf2.squeeze())
816 assert_eq(ds.squeeze(), s.squeeze())
817
818 with pytest.raises(NotImplementedError) as info:
819 ddf.squeeze(axis=0)
820 msg = f"{type(ddf)} does not support squeeze along axis 0"
821 assert msg in str(info.value)
822
823 with pytest.raises(ValueError) as info:
824 ddf.squeeze(axis=2)
825 msg = f"No axis {2} for object type {type(ddf)}"
826 assert msg in str(info.value)
827
828 with pytest.raises(ValueError) as info:
829 ddf.squeeze(axis="test")
830 msg = f"No axis test for object type {type(ddf)}"
831 assert msg in str(info.value)
832
833
834def test_where_mask():

Callers

nothing calls this directly

Calls 3

squeezeMethod · 0.95
squeezeMethod · 0.95
assert_eqFunction · 0.90

Tested by

no test coverage detected