Skip to content

[#22550] Remove TestData from series-tests test_operators.py #29084

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

Merged
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
18 changes: 8 additions & 10 deletions pandas/tests/series/test_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
assert_series_equal,
)

from .common import TestData


class TestSeriesLogicalOps:
@pytest.mark.parametrize("bool_op", [operator.and_, operator.or_, operator.xor])
Expand Down Expand Up @@ -746,7 +744,7 @@ def test_comparison_flex_alignment_fill(self):
assert_series_equal(left.gt(right, fill_value=0), exp)


class TestSeriesOperators(TestData):
class TestSeriesOperators:
def test_operators_empty_int_corner(self):
s1 = Series([], [], dtype=np.int32)
s2 = Series({"x": 0.0})
Expand All @@ -768,12 +766,10 @@ def test_ops_datetimelike_align(self):
result = (dt2.to_frame() - dt.to_frame())[0]
assert_series_equal(result, expected)

def test_operators_corner(self):
series = self.ts

def test_operators_corner(self, datetime_series):
empty = Series([], index=Index([]))

result = series + empty
result = datetime_series + empty
assert np.isnan(result).all()

result = empty + Series([], index=Index([]))
Expand All @@ -786,10 +782,12 @@ def test_operators_corner(self):
# deltas = deltas + sub_deltas

# float + int
int_ts = self.ts.astype(int)[:-5]
added = self.ts + int_ts
int_ts = datetime_series.astype(int)[:-5]
added = datetime_series + int_ts
expected = Series(
self.ts.values[:-5] + int_ts.values, index=self.ts.index[:-5], name="ts"
datetime_series.values[:-5] + int_ts.values,
index=datetime_series.index[:-5],
name="ts",
)
tm.assert_series_equal(added[:-5], expected)

Expand Down