Skip to content

Add fixture docstring for series indexing #59292

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 2 commits into from
Jul 23, 2024
Merged
Changes from 1 commit
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
23 changes: 23 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,48 @@ def test_setitem_example(self):

@pytest.fixture
def obj(self):
"""
Fixture to create a Series instance using IntervalIndex
[(0, 1], (1, 2], (2, 3]]
Copy link
Member

Choose a reason for hiding this comment

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

Can you ensure all these docstrings are 1 line. i.e. Just have a 1 line description

Copy link
Contributor Author

@sliuos sliuos Jul 23, 2024

Choose a reason for hiding this comment

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

Converted all added doc strings to one line only in the new commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Linux-32-bit check failed. Please advise if any further change is needed ?

"""
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 instance with dtype:float64 using the given
input fixture obj and fixture val.
Parameters:
obj(Series): [(0, 1], (1, 2], (2, 3]]
val(Interval): (0.5, 1.5]

Returns:
(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