Skip to content

Commit

Permalink
Assert deprecation warning on DataFrame.__setitem__ in tests (#4126)
Browse files Browse the repository at this point in the history
  • Loading branch information
zundertj committed Jul 23, 2022
1 parent 00fef40 commit dc808bb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions py-polars/tests/test_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,18 @@ def test_replace_at_idx() -> None:


def test_indexing_set() -> None:
# This is deprecated behaviour
df = pl.DataFrame({"bool": [True, True], "str": ["N/A", "N/A"], "nr": [1, 2]})
df[0, "bool"] = False
df[0, "nr"] = 100
df[0, "str"] = "foo"

with pytest.deprecated_call():
df[0, "bool"] = False

with pytest.deprecated_call():
df[0, "nr"] = 100

with pytest.deprecated_call():
df[0, "str"] = "foo"

assert df.to_dict(False) == {
"bool": [False, True],
"str": ["foo", "N/A"],
Expand Down

0 comments on commit dc808bb

Please sign in to comment.