Skip to content

Commit

Permalink
Backport PR pandas-dev#56595: TST/CLN: Inline seldom used fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke authored and meeseeksmachine committed Dec 24, 2023
1 parent d4c8d82 commit 4904bc8
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 30 deletions.
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

0 comments on commit 4904bc8

Please sign in to comment.