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

Function test_squeeze

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

Source from the content-addressed store, hash-verified

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