Skip to content

Commit bcf38d6

Browse files
committed
adding pytest
1 parent 7b4fc6c commit bcf38d6

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

tests/test_frame.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import numpy as np
3030
import numpy.typing as npt
3131
import pandas as pd
32-
from pandas._testing import ensure_clean
32+
from pandas._testing import ensure_clean, assert_frame_equal
3333
from pandas.core.resample import (
3434
DatetimeIndexResampler,
3535
Resampler,
@@ -368,6 +368,33 @@ def test_types_dropna() -> None:
368368
res3: None = df.dropna(axis=0, how="all", subset=["col1"], inplace=True)
369369

370370

371+
@pytest.mark.parametrize(
372+
"drop_arg",
373+
[
374+
{"AAA"}, # set
375+
["AAA"], # list
376+
("AAA",), # tuple
377+
{"AAA": None}, # dict
378+
"AAA", # str
379+
]
380+
)
381+
def test_types_drop_duplicates(drop_arg) -> None:
382+
383+
# GH#59237
384+
df = pd.DataFrame(
385+
{
386+
"AAA": ["foo", "bar", "foo", "bar", "foo", "bar", "bar", "foo"],
387+
"B": ["one", "one", "two", "two", "two", "two", "one", "two"],
388+
"C": [1, 1, 2, 2, 2, 2, 1, 2],
389+
"D": range(8),
390+
}
391+
)
392+
expected = df[:2]
393+
394+
result = df.drop_duplicates(drop_arg)
395+
assert_frame_equal(result, expected)
396+
397+
371398
def test_types_fillna() -> None:
372399
df = pd.DataFrame(data={"col1": [np.nan, np.nan], "col2": [3, np.nan]})
373400
res: pd.DataFrame = df.fillna(0)

0 commit comments

Comments
 (0)