File tree 2 files changed +6
-4
lines changed
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -411,9 +411,11 @@ cdef class Interval(IntervalMixin):
411
411
return hash ((self .left, self .right, self .inclusive))
412
412
413
413
def __contains__ (self , key ) -> bool:
414
- if isinstance(key , Interval ):
415
- return ((self .left < key.left if self .open_left and key.closed_left else self .left <= key.left) and
416
- (key.right < self .right if self .open_right and key.closed_right else key.right <= self .right))
414
+ if _interval_like(key ):
415
+ key_closed_left = key.inclusive in (' left' , ' both' )
416
+ key_closed_right = key.inclusive in (' right' , ' both' )
417
+ return ((self .left < key.left if self .open_left and key_closed_left else self .left <= key.left) and
418
+ (key.right < self .right if self .open_right and key_closed_right else key.right <= self .right))
417
419
return ((self .left < key if self .open_left else self .left <= key) and
418
420
(key < self .right if self .open_right else key <= self .right))
419
421
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ def __new__(
135
135
136
136
# validate the arguments
137
137
if com .all_none (start , stop , step ):
138
- raise TypeError ("RangeIndex(...) must be called with integers" )
138
+ raise TypeError ("RangeIndex(...) must be called with integers/floats " )
139
139
140
140
start = ensure_python_int (start ) if start is not None else 0
141
141
You can’t perform that action at this time.
0 commit comments