Skip to content

Commit

Permalink
Add fixture docstring for series indexing (#59292)
Browse files Browse the repository at this point in the history
* Add fixture docstring for series indexing

* Make fixture docstring one line only

---------

Co-authored-by: Shawn Liu <sl@Shawns-Mac-mini.fios-router.home>
  • Loading branch information
sliuos and Shawn Liu authored Jul 23, 2024
1 parent 67a58cd commit 31a1df1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pandas/tests/series/indexing/test_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1178,25 +1178,40 @@ def test_setitem_example(self):

@pytest.fixture
def obj(self):
"""
Fixture to create a Series [(0, 1], (1, 2], (2, 3]]
"""
idx = IntervalIndex.from_breaks(range(4))
return Series(idx)

@pytest.fixture
def val(self):
"""
Fixture to get an interval (0.5, 1.5]
"""
return Interval(0.5, 1.5)

@pytest.fixture
def key(self):
"""
Fixture to get a key 0
"""
return 0

@pytest.fixture
def expected(self, obj, val):
"""
Fixture to get a Series [(0.5, 1.5], (1.0, 2.0], (2.0, 3.0]]
"""
data = [val] + list(obj[1:])
idx = IntervalIndex(data, dtype="Interval[float64]")
return Series(idx)

@pytest.fixture
def raises(self):
"""
Fixture to enable raising pytest exceptions
"""
return True


Expand Down

0 comments on commit 31a1df1

Please sign in to comment.