Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST/REF: misplaced tests in tests.base #37410

Merged
merged 2 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions pandas/tests/base/test_drop_duplicates.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from datetime import datetime

import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm


def test_drop_duplicates_series_vs_dataframe():
@pytest.mark.parametrize("keep", ["first", "last", False])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally make this a well named top-level fixture

def test_drop_duplicates_series_vs_dataframe(keep):
# GH 14192
df = pd.DataFrame(
{
Expand All @@ -24,7 +26,6 @@ def test_drop_duplicates_series_vs_dataframe():
}
)
for column in df.columns:
for keep in ["first", "last", False]:
dropped_frame = df[[column]].drop_duplicates(keep=keep)
dropped_series = df[column].drop_duplicates(keep=keep)
tm.assert_frame_equal(dropped_frame, dropped_series.to_frame())
dropped_frame = df[[column]].drop_duplicates(keep=keep)
dropped_series = df[column].drop_duplicates(keep=keep)
tm.assert_frame_equal(dropped_frame, dropped_series.to_frame())
8 changes: 0 additions & 8 deletions pandas/tests/base/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import pandas as pd
from pandas import DataFrame, Index, IntervalIndex, Series
import pandas._testing as tm


@pytest.mark.parametrize(
Expand Down Expand Up @@ -196,10 +195,3 @@ def test_access_by_position(index):
msg = "single positional indexer is out-of-bounds"
with pytest.raises(IndexError, match=msg):
series.iloc[size]


def test_get_indexer_non_unique_dtype_mismatch():
# GH 25459
indexes, missing = Index(["A", "B"]).get_indexer_non_unique(Index([0]))
tm.assert_numpy_array_equal(np.array([-1], dtype=np.intp), indexes)
tm.assert_numpy_array_equal(np.array([0], dtype=np.intp), missing)
10 changes: 10 additions & 0 deletions pandas/tests/indexes/base_class/test_indexing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import numpy as np
import pytest

from pandas import Index
import pandas._testing as tm


class TestGetSliceBounds:
Expand All @@ -24,3 +26,11 @@ def test_get_slice_bounds_outside(self, kind, side, expected, data, bound):
def test_get_slice_bounds_invalid_side(self):
with pytest.raises(ValueError, match="Invalid value for side kwarg"):
Index([]).get_slice_bound("a", kind=None, side="middle")


class TestGetIndexerNonUnique:
def test_get_indexer_non_unique_dtype_mismatch(self):
# GH#25459
indexes, missing = Index(["A", "B"]).get_indexer_non_unique(Index([0]))
tm.assert_numpy_array_equal(np.array([-1], dtype=np.intp), indexes)
tm.assert_numpy_array_equal(np.array([0], dtype=np.intp), missing)