Skip to content

TST/CLN: Inline seldom used fixture #56595

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
merged 3 commits into from
Dec 24, 2023
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
9 changes: 0 additions & 9 deletions pandas/tests/arrays/categorical/conftest.py

This file was deleted.

3 changes: 2 additions & 1 deletion pandas/tests/arrays/categorical/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ def test_remove_unused_categories(self):


class TestCategoricalAPIWithFactor:
def test_describe(self, factor):
def test_describe(self):
factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
# string type
desc = factor.describe()
assert factor.ordered
Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/arrays/categorical/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@


class TestCategoricalIndexingWithFactor:
def test_getitem(self, factor):
def test_getitem(self):
factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
assert factor[0] == "a"
assert factor[-1] == "c"

Expand All @@ -31,7 +32,8 @@ def test_getitem(self, factor):
subf = factor[np.asarray(factor) == "c"]
tm.assert_numpy_array_equal(subf._codes, np.array([2, 2, 2], dtype=np.int8))

def test_setitem(self, factor):
def test_setitem(self):
factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
# int/positional
c = factor.copy()
c[0] = "b"
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/arrays/categorical/test_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def test_categories_none_comparisons(self):
factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
tm.assert_categorical_equal(factor, factor)

def test_comparisons(self, factor):
def test_comparisons(self):
factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
result = factor[factor == "a"]
expected = factor[np.asarray(factor) == "a"]
tm.assert_categorical_equal(result, expected)
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/arrays/categorical/test_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@


class TestCategoricalReprWithFactor:
def test_print(self, factor, using_infer_string):
def test_print(self, using_infer_string):
factor = Categorical(["a", "b", "b", "a", "a", "c", "c", "c"], ordered=True)
if using_infer_string:
expected = [
"['a', 'b', 'b', 'a', 'a', 'c', 'c', 'c']",
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/indexes/datetimes/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
)
import pandas._testing as tm

START, END = datetime(2009, 1, 1), datetime(2010, 1, 1)


class TestDatetimeIndexOps:
def test_infer_freq(self, freq_sample):
Expand All @@ -26,6 +24,7 @@ def test_infer_freq(self, freq_sample):
class TestBusinessDatetimeIndex:
@pytest.fixture
def rng(self, freq):
START, END = datetime(2009, 1, 1), datetime(2010, 1, 1)
return bdate_range(START, END, freq=freq)

def test_comparison(self, rng):
Expand Down
13 changes: 0 additions & 13 deletions pandas/tests/tseries/offsets/conftest.py

This file was deleted.

3 changes: 2 additions & 1 deletion pandas/tests/tseries/offsets/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def test_sub(date, offset_box, offset2):
[BusinessHour, BusinessHour()],
],
)
def test_Mult1(offset_box, offset1, dt):
def test_Mult1(offset_box, offset1):
dt = Timestamp(2008, 1, 2)
assert dt + 10 * offset1 == dt + offset_box(10)
assert dt + 5 * offset1 == dt + offset_box(5)

Expand Down