Skip to content

Commit 95c7036

Browse files
committed
Add tests for invalid arguments
1 parent 975231c commit 95c7036

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

streamz/dataframe/tests/test_dataframes.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,26 @@ def test_ewm_mean():
744744
assert_eq(result, expected)
745745

746746

747+
def test_ewm_raise_multiple_arguments():
748+
sdf = DataFrame(example=pd.DataFrame(columns=['x', 'y']))
749+
with pytest.raises(ValueError, match="Can only provide one of"):
750+
sdf.ewm(com=1, halflife=1)
751+
752+
753+
def test_ewm_raise_no_argument():
754+
sdf = DataFrame(example=pd.DataFrame(columns=['x', 'y']))
755+
with pytest.raises(ValueError, match="Must pass one of"):
756+
sdf.ewm()
757+
758+
759+
@pytest.mark.parametrize("arg", ["com", "halflife", "alpha", "span"])
760+
def test_raise_invalid_argument(arg):
761+
sdf = DataFrame(example=pd.DataFrame(columns=['x', 'y']))
762+
param = {arg: -1}
763+
with pytest.raises(ValueError):
764+
sdf.ewm(**param)
765+
766+
747767
@pytest.mark.parametrize('func', [
748768
lambda x: x.sum(),
749769
lambda x: x.count(),

0 commit comments

Comments
 (0)