Skip to content

Commit 1a677d7

Browse files
jbrockmendelKevin D Smith
authored and
Kevin D Smith
committed
TST/REF: misplaced tests in tests.base (pandas-dev#37410)
1 parent 6c3a091 commit 1a677d7

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

pandas/tests/base/test_drop_duplicates.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from datetime import datetime
22

33
import numpy as np
4+
import pytest
45

56
import pandas as pd
67
import pandas._testing as tm
78

89

9-
def test_drop_duplicates_series_vs_dataframe():
10+
@pytest.mark.parametrize("keep", ["first", "last", False])
11+
def test_drop_duplicates_series_vs_dataframe(keep):
1012
# GH 14192
1113
df = pd.DataFrame(
1214
{
@@ -24,7 +26,6 @@ def test_drop_duplicates_series_vs_dataframe():
2426
}
2527
)
2628
for column in df.columns:
27-
for keep in ["first", "last", False]:
28-
dropped_frame = df[[column]].drop_duplicates(keep=keep)
29-
dropped_series = df[column].drop_duplicates(keep=keep)
30-
tm.assert_frame_equal(dropped_frame, dropped_series.to_frame())
29+
dropped_frame = df[[column]].drop_duplicates(keep=keep)
30+
dropped_series = df[column].drop_duplicates(keep=keep)
31+
tm.assert_frame_equal(dropped_frame, dropped_series.to_frame())

pandas/tests/base/test_misc.py

-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import pandas as pd
1616
from pandas import DataFrame, Index, IntervalIndex, Series
17-
import pandas._testing as tm
1817

1918

2019
@pytest.mark.parametrize(
@@ -196,10 +195,3 @@ def test_access_by_position(index):
196195
msg = "single positional indexer is out-of-bounds"
197196
with pytest.raises(IndexError, match=msg):
198197
series.iloc[size]
199-
200-
201-
def test_get_indexer_non_unique_dtype_mismatch():
202-
# GH 25459
203-
indexes, missing = Index(["A", "B"]).get_indexer_non_unique(Index([0]))
204-
tm.assert_numpy_array_equal(np.array([-1], dtype=np.intp), indexes)
205-
tm.assert_numpy_array_equal(np.array([0], dtype=np.intp), missing)

pandas/tests/indexes/base_class/test_indexing.py

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import numpy as np
12
import pytest
23

34
from pandas import Index
5+
import pandas._testing as tm
46

57

68
class TestGetSliceBounds:
@@ -24,3 +26,11 @@ def test_get_slice_bounds_outside(self, kind, side, expected, data, bound):
2426
def test_get_slice_bounds_invalid_side(self):
2527
with pytest.raises(ValueError, match="Invalid value for side kwarg"):
2628
Index([]).get_slice_bound("a", kind=None, side="middle")
29+
30+
31+
class TestGetIndexerNonUnique:
32+
def test_get_indexer_non_unique_dtype_mismatch(self):
33+
# GH#25459
34+
indexes, missing = Index(["A", "B"]).get_indexer_non_unique(Index([0]))
35+
tm.assert_numpy_array_equal(np.array([-1], dtype=np.intp), indexes)
36+
tm.assert_numpy_array_equal(np.array([0], dtype=np.intp), missing)

0 commit comments

Comments
 (0)