Skip to content

Commit a516870

Browse files
authored
type RangeIndex properties (#1115)
1 parent 2cc6fa2 commit a516870

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

pandas-stubs/core/indexes/range.pyi

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ class RangeIndex(Index[int]):
2424
@classmethod
2525
def from_range(cls, data, name=..., dtype=...): ...
2626
def __reduce__(self): ...
27-
def start(self): ...
28-
def stop(self): ...
29-
def step(self): ...
27+
@property
28+
def start(self) -> int: ...
29+
@property
30+
def stop(self) -> int: ...
31+
@property
32+
def step(self) -> int: ...
3033
@property
3134
def nbytes(self) -> int: ...
3235
def memory_usage(self, deep: bool = ...) -> int: ...

tests/test_indexes.py

+7
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ def test_range_index_union():
252252
)
253253

254254

255+
def test_range_index_start_stop_step():
256+
idx = pd.RangeIndex(3)
257+
check(assert_type(idx.start, int), int)
258+
check(assert_type(idx.stop, int), int)
259+
check(assert_type(idx.step, int), int)
260+
261+
255262
def test_interval_range():
256263
check(
257264
assert_type(pd.interval_range(0, 10), "pd.IntervalIndex[pd.Interval[int]]"),

0 commit comments

Comments
 (0)