diff --git a/tests/test_meta/test_regression_outlier.py b/tests/test_meta/test_regression_outlier.py index 61b12b7e..2cd1fa81 100644 --- a/tests/test_meta/test_regression_outlier.py +++ b/tests/test_meta/test_regression_outlier.py @@ -27,7 +27,7 @@ def test_obvious_example(): X = np.random.normal(0, 1, (100, 1)) y = 1 + np.sum(X, axis=1).reshape(-1, 1) + np.random.normal(0, 0.2, (100, 1)) for i in [20, 25, 50, 80]: - y[i] += 2 + y[i] += 10 X = np.concatenate([X, y], axis=1) # fit and plot @@ -44,7 +44,7 @@ def test_obvious_example_dataframe(frame_func): x = np.random.normal(0, 1, 100) y = 1 + x + np.random.normal(0, 0.2, 100) for i in [20, 25, 50, 80]: - y[i] += 2 + y[i] += 10 X = frame_func({"x": x, "y": y}) # fit and plot diff --git a/tests/test_pandas_utils/test_pandas_utils.py b/tests/test_pandas_utils/test_pandas_utils.py index b8f956b9..fd501574 100644 --- a/tests/test_pandas_utils/test_pandas_utils.py +++ b/tests/test_pandas_utils/test_pandas_utils.py @@ -27,7 +27,7 @@ def test_X(): return np.array([[-4, 2], [-2, 0], [4, -6]]) -@pytest.mark.parametrize("frame_func", [pd.DataFrame, pl.DataFrame]) +@pytest.mark.parametrize("frame_func", [pd.DataFrame, lambda data: pl.DataFrame(data, strict=False)]) def test_add_lags_wrong_inputs(data, frame_func): invalid_df = [[1, 2, 3], [4, 5, 6]] invalid_lags = ["1", "2"] @@ -38,7 +38,10 @@ def test_add_lags_wrong_inputs(data, frame_func): add_lags(invalid_df, ["X1"], 1) -@pytest.mark.parametrize("frame_func", [pd.DataFrame, pl.DataFrame, pl.LazyFrame]) +@pytest.mark.parametrize( + "frame_func", + [pd.DataFrame, lambda data: pl.DataFrame(data, strict=False), lambda data: pl.LazyFrame(data, strict=False)], +) def test_add_lags_correct_df(data, frame_func): test_df = frame_func(data) expected = frame_func({"X1": [1, 2], "X2": ["178", "154"], "X1-1": [0, 1]}) @@ -56,7 +59,7 @@ def test_add_lags_correct_X(test_X): assert (add_lags(test_X, [0, 1], [1, 2]) == expected).all() -@pytest.mark.parametrize("frame_func", [pd.DataFrame, pl.DataFrame]) +@pytest.mark.parametrize("frame_func", [pd.DataFrame, lambda data: pl.DataFrame(data, strict=False)]) def test_add_lagged_dataframe_columns(data, frame_func): test_df = nw.from_native(frame_func(data)) with pytest.raises(KeyError, match="The column does not exist"):