@@ -627,6 +627,7 @@ def test_repr_max_seq_item_setting(self):
627
627
def test_repr_roundtrip (self ):
628
628
super (TestIntervalIndex , self ).test_repr_roundtrip ()
629
629
630
+ # TODO: check this behavior is consistent with test_interval_new.py
630
631
def test_get_item (self , closed ):
631
632
i = IntervalIndex .from_arrays ((0 , 1 , np .nan ), (1 , 2 , np .nan ),
632
633
closed = closed )
@@ -647,6 +648,7 @@ def test_get_item(self, closed):
647
648
closed = closed )
648
649
tm .assert_index_equal (result , expected )
649
650
651
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
650
652
def test_get_loc_value (self ):
651
653
pytest .raises (KeyError , self .index .get_loc , 0 )
652
654
assert self .index .get_loc (0.5 ) == 0
@@ -669,6 +671,7 @@ def test_get_loc_value(self):
669
671
idx = IntervalIndex .from_arrays ([0 , 2 ], [1 , 3 ])
670
672
pytest .raises (KeyError , idx .get_loc , 1.5 )
671
673
674
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
672
675
def slice_locs_cases (self , breaks ):
673
676
# TODO: same tests for more index types
674
677
index = IntervalIndex .from_breaks ([0 , 1 , 2 ], closed = 'right' )
@@ -697,12 +700,15 @@ def slice_locs_cases(self, breaks):
697
700
assert index .slice_locs (1 , 1 ) == (0 , 1 )
698
701
assert index .slice_locs (1 , 2 ) == (0 , 2 )
699
702
703
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
700
704
def test_slice_locs_int64 (self ):
701
705
self .slice_locs_cases ([0 , 1 , 2 ])
702
706
707
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
703
708
def test_slice_locs_float64 (self ):
704
709
self .slice_locs_cases ([0.0 , 1.0 , 2.0 ])
705
710
711
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
706
712
def slice_locs_decreasing_cases (self , tuples ):
707
713
index = IntervalIndex .from_tuples (tuples )
708
714
assert index .slice_locs (1.5 , 0.5 ) == (1 , 3 )
@@ -716,17 +722,21 @@ def slice_locs_decreasing_cases(self, tuples):
716
722
slice_locs = index .slice_locs (- 1 , - 1 )
717
723
assert slice_locs [0 ] == slice_locs [1 ]
718
724
725
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
719
726
def test_slice_locs_decreasing_int64 (self ):
720
727
self .slice_locs_cases ([(2 , 4 ), (1 , 3 ), (0 , 2 )])
721
728
729
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
722
730
def test_slice_locs_decreasing_float64 (self ):
723
731
self .slice_locs_cases ([(2. , 4. ), (1. , 3. ), (0. , 2. )])
724
732
733
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
725
734
def test_slice_locs_fails (self ):
726
735
index = IntervalIndex .from_tuples ([(1 , 2 ), (0 , 1 ), (2 , 3 )])
727
736
with pytest .raises (KeyError ):
728
737
index .slice_locs (1 , 2 )
729
738
739
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
730
740
def test_get_loc_interval (self ):
731
741
assert self .index .get_loc (Interval (0 , 1 )) == 0
732
742
assert self .index .get_loc (Interval (0 , 0.5 )) == 0
@@ -735,6 +745,7 @@ def test_get_loc_interval(self):
735
745
pytest .raises (KeyError , self .index .get_loc ,
736
746
Interval (- 1 , 0 , 'left' ))
737
747
748
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
738
749
def test_get_indexer (self ):
739
750
actual = self .index .get_indexer ([- 1 , 0 , 0.5 , 1 , 1.5 , 2 , 3 ])
740
751
expected = np .array ([- 1 , - 1 , 0 , 0 , 1 , 1 , - 1 ], dtype = 'intp' )
@@ -757,6 +768,7 @@ def test_get_indexer(self):
757
768
expected = np .array ([- 1 , 1 ], dtype = 'intp' )
758
769
tm .assert_numpy_array_equal (actual , expected )
759
770
771
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
760
772
def test_get_indexer_subintervals (self ):
761
773
762
774
# TODO: is this right?
@@ -780,6 +792,7 @@ def test_get_indexer_subintervals(self):
780
792
expected = np .array ([0 , 0 , 0 ], dtype = 'intp' )
781
793
tm .assert_numpy_array_equal (actual , expected )
782
794
795
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
783
796
def test_contains (self ):
784
797
# Only endpoints are valid.
785
798
i = IntervalIndex .from_arrays ([0 , 1 ], [1 , 2 ])
@@ -796,6 +809,7 @@ def test_contains(self):
796
809
assert Interval (3 , 5 ) not in i
797
810
assert Interval (- 1 , 0 , closed = 'left' ) not in i
798
811
812
+ # To be removed, replaced by test_interval_new.py (see #16316, #16386)
799
813
def testcontains (self ):
800
814
# can select values that are IN the range of a value
801
815
i = IntervalIndex .from_arrays ([0 , 1 ], [1 , 2 ])
@@ -827,6 +841,7 @@ def test_dropna(self, closed):
827
841
result = ii .dropna ()
828
842
tm .assert_index_equal (result , expected )
829
843
844
+ # TODO: check this behavior is consistent with test_interval_new.py
830
845
def test_non_contiguous (self , closed ):
831
846
index = IntervalIndex .from_tuples ([(0 , 1 ), (2 , 3 )], closed = closed )
832
847
target = [0.5 , 1.5 , 2.5 ]
0 commit comments