Skip to content

Commit fed8820

Browse files
Shawn LiuShawn Liu
authored andcommitted
Add fixture docstring for series indexing
1 parent 18a3eec commit fed8820

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pandas/tests/series/indexing/test_setitem.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,25 +1178,48 @@ def test_setitem_example(self):
11781178

11791179
@pytest.fixture
11801180
def obj(self):
1181+
"""
1182+
Fixture to create a Series instance using IntervalIndex
1183+
[(0, 1], (1, 2], (2, 3]]
1184+
"""
11811185
idx = IntervalIndex.from_breaks(range(4))
11821186
return Series(idx)
11831187

11841188
@pytest.fixture
11851189
def val(self):
1190+
"""
1191+
Fixture to get an interval (0.5, 1.5]
1192+
"""
11861193
return Interval(0.5, 1.5)
11871194

11881195
@pytest.fixture
11891196
def key(self):
1197+
"""
1198+
Fixture to get a key 0
1199+
"""
11901200
return 0
11911201

11921202
@pytest.fixture
11931203
def expected(self, obj, val):
1204+
"""
1205+
Fixture to get a Series instance with dtype:float64 using the given
1206+
input fixture obj and fixture val.
1207+
Parameters:
1208+
obj(Series): [(0, 1], (1, 2], (2, 3]]
1209+
val(Interval): (0.5, 1.5]
1210+
1211+
Returns:
1212+
(Series): [(0.5, 1.5], (1.0, 2.0], (2.0, 3.0]]
1213+
"""
11941214
data = [val] + list(obj[1:])
11951215
idx = IntervalIndex(data, dtype="Interval[float64]")
11961216
return Series(idx)
11971217

11981218
@pytest.fixture
11991219
def raises(self):
1220+
"""
1221+
Fixture to enable raising pytest exceptions
1222+
"""
12001223
return True
12011224

12021225

0 commit comments

Comments
 (0)